結果
問題 | No.434 占い |
ユーザー | 👑 testestest |
提出日時 | 2016-10-15 04:24:51 |
言語 | C90 (gcc 11.4.0) |
結果 |
AC
|
実行時間 | 14 ms / 2,000 ms |
コード長 | 389 bytes |
コンパイル時間 | 307 ms |
コンパイル使用メモリ | 21,888 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-11-22 11:17:21 |
合計ジャッジ時間 | 1,311 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 0 ms
5,248 KB |
testcase_01 | AC | 0 ms
5,248 KB |
testcase_02 | AC | 0 ms
5,248 KB |
testcase_03 | AC | 1 ms
5,248 KB |
testcase_04 | AC | 1 ms
5,248 KB |
testcase_05 | AC | 1 ms
5,248 KB |
testcase_06 | AC | 0 ms
5,248 KB |
testcase_07 | AC | 1 ms
5,248 KB |
testcase_08 | AC | 1 ms
5,248 KB |
testcase_09 | AC | 1 ms
5,248 KB |
testcase_10 | AC | 1 ms
5,248 KB |
testcase_11 | AC | 1 ms
5,248 KB |
testcase_12 | AC | 2 ms
5,248 KB |
testcase_13 | AC | 1 ms
5,248 KB |
testcase_14 | AC | 0 ms
5,248 KB |
testcase_15 | AC | 3 ms
5,248 KB |
testcase_16 | AC | 2 ms
5,248 KB |
testcase_17 | AC | 2 ms
5,248 KB |
testcase_18 | AC | 2 ms
5,248 KB |
testcase_19 | AC | 3 ms
5,248 KB |
testcase_20 | AC | 14 ms
5,248 KB |
testcase_21 | AC | 2 ms
5,248 KB |
testcase_22 | AC | 2 ms
5,248 KB |
testcase_23 | AC | 0 ms
5,248 KB |
testcase_24 | AC | 2 ms
5,248 KB |
testcase_25 | AC | 2 ms
5,248 KB |
testcase_26 | AC | 1 ms
5,248 KB |
testcase_27 | AC | 2 ms
5,248 KB |
testcase_28 | AC | 2 ms
5,248 KB |
testcase_29 | AC | 3 ms
5,248 KB |
testcase_30 | AC | 11 ms
5,248 KB |
コンパイルメッセージ
main.c:2:1: warning: data definition has no type or storage class 2 | n,i,t,ans,c,c3; | ^ main.c:2:1: warning: type defaults to ‘int’ in declaration of ‘n’ [-Wimplicit-int] main.c:2:3: warning: type defaults to ‘int’ in declaration of ‘i’ [-Wimplicit-int] 2 | n,i,t,ans,c,c3; | ^ main.c:2:5: warning: type defaults to ‘int’ in declaration of ‘t’ [-Wimplicit-int] 2 | n,i,t,ans,c,c3; | ^ main.c:2:7: warning: type defaults to ‘int’ in declaration of ‘ans’ [-Wimplicit-int] 2 | n,i,t,ans,c,c3; | ^~~ main.c:2:11: warning: type defaults to ‘int’ in declaration of ‘c’ [-Wimplicit-int] 2 | n,i,t,ans,c,c3; | ^ main.c:2:13: warning: type defaults to ‘int’ in declaration of ‘c3’ [-Wimplicit-int] 2 | n,i,t,ans,c,c3; | ^~ main.c:3:1: warning: data definition has no type or storage class 3 | inv9[]={0,1,5,0,7,2,0,4,8}; | ^~~~ main.c:3:1: warning: type defaults to ‘int’ in declaration of ‘inv9’ [-Wimplicit-int] main.c:4:1: warning: return type defaults to ‘int’ [-Wimplicit-int] 4 | f3(n){int i=0;for(;n&&n%3==0;n/=3)i++;return i;} | ^~ main.c: In function ‘f3’: main.c:4:1: warning: type of ‘n’ defaults to ‘int’ [-Wimplicit-int] main.c: At top level: main.c:5:1: warning: return type defaults to ‘int’ [-Wimplicit-int] 5 | g3(n){for(;n&&n%3==0;n/=3);return n;} | ^~ main.c: In function ‘g3’: main.c:5:1: warning: type of ‘n’ defaults to ‘int’ [-Wimplicit-int] main.c: At top level: main.c:6:1: warning: return type defaults to ‘int’ [-Wimplicit-int] 6 | main(){ | ^~~~ main.c: In function ‘main’: main.c:7:13: warning: implicit declaration of function ‘gets’ [-Wimplicit-function-declaration] 7 | for(gets(s);gets(s);){ | ^~~~ main.c:8:19: warning: implicit declaration of function ‘strlen’ [-Wimplicit-function-declaration] 8 |
ソースコード
char s[100010]; n,i,t,ans,c,c3; inv9[]={0,1,5,0,7,2,0,4,8}; f3(n){int i=0;for(;n&&n%3==0;n/=3)i++;return i;} g3(n){for(;n&&n%3==0;n/=3);return n;} main(){ for(gets(s);gets(s);){ n=strlen(s)-1; t=ans=c3=0,c=1; for(i=0;i<=n;i++){ t+=s[i]-48; ans+=c*(c3?c3==1?3:0:1)*(s[i]-48)%9; c3+=f3(n-i)-f3(i+1); c=(c*g3(n-i)*inv9[g3(i+1)%9])%9; } printf("%d\n",ans%9?:t?9:0); } }