結果
問題 | No.435 占い(Extra) |
ユーザー | 👑 testestest |
提出日時 | 2016-10-15 04:25:01 |
言語 | C90 (gcc 11.4.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 389 bytes |
コンパイル時間 | 736 ms |
コンパイル使用メモリ | 21,760 KB |
実行使用メモリ | 6,824 KB |
最終ジャッジ日時 | 2024-10-08 11:58:41 |
合計ジャッジ時間 | 2,096 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | WA | - |
testcase_01 | WA | - |
testcase_02 | WA | - |
testcase_03 | WA | - |
testcase_04 | WA | - |
testcase_05 | WA | - |
testcase_06 | WA | - |
testcase_07 | WA | - |
testcase_08 | WA | - |
testcase_09 | WA | - |
testcase_10 | WA | - |
testcase_11 | WA | - |
testcase_12 | WA | - |
testcase_13 | WA | - |
testcase_14 | WA | - |
testcase_15 | WA | - |
testcase_16 | WA | - |
testcase_17 | WA | - |
testcase_18 | WA | - |
testcase_19 | WA | - |
testcase_20 | WA | - |
testcase_21 | WA | - |
testcase_22 | WA | - |
testcase_23 | WA | - |
testcase_24 | WA | - |
testcase_25 | WA | - |
testcase_26 | WA | - |
testcase_27 | WA | - |
testcase_28 | WA | - |
testcase_29 | WA | - |
testcase_30 | WA | - |
testcase_31 | WA | - |
testcase_32 | WA | - |
testcase_33 | WA | - |
testcase_34 | WA | - |
testcase_35 | WA | - |
コンパイルメッセージ
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); } }