結果

問題 No.434 占い
ユーザー 👑 testestesttestestest
提出日時 2016-10-15 04:08:53
言語 C90
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 422 bytes
コンパイル時間 1,398 ms
コンパイル使用メモリ 21,504 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-11-22 11:17:20
合計ジャッジ時間 2,006 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
5,248 KB
testcase_01 AC 1 ms
5,248 KB
testcase_02 AC 0 ms
5,248 KB
testcase_03 AC 1 ms
5,248 KB
testcase_04 WA -
testcase_05 AC 1 ms
5,248 KB
testcase_06 AC 1 ms
5,248 KB
testcase_07 AC 1 ms
5,248 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 AC 1 ms
5,248 KB
testcase_12 AC 2 ms
5,248 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 AC 3 ms
5,248 KB
testcase_20 AC 13 ms
5,248 KB
testcase_21 WA -
testcase_22 WA -
testcase_23 AC 0 ms
5,248 KB
testcase_24 WA -
testcase_25 AC 2 ms
5,248 KB
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c:2:1: warning: data definition has no type or storage class
    2 | n,i,t,ans,c2,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,c2,c3;
      |   ^
main.c:2:5: warning: type defaults to ‘int’ in declaration of ‘t’ [-Wimplicit-int]
    2 | n,i,t,ans,c2,c3;
      |     ^
main.c:2:7: warning: type defaults to ‘int’ in declaration of ‘ans’ [-Wimplicit-int]
    2 | n,i,t,ans,c2,c3;
      |       ^~~
main.c:2:11: warning: type defaults to ‘int’ in declaration of ‘c2’ [-Wimplicit-int]
    2 | n,i,t,ans,c2,c3;
      |           ^~
main.c:2:14: warning: type defaults to ‘int’ in declaration of ‘c3’ [-Wimplicit-int]
    2 | n,i,t,ans,c2,c3;
      |              ^~
main.c:3:1: warning: data definition has no type or storage class
    3 | p2[]={1,2,4,8,7,5};
      | ^~
main.c:3:1: warning: type defaults to ‘int’ in declaration of ‘p2’ [-Wimplicit-int]
main.c:4:1: warning: return type defaults to ‘int’ [-Wimplicit-int]
    4 | f2(n){int i=0;for(;n&&n%2==0;n/=2)i++;return i;}
      | ^~
main.c: In function ‘f2’:
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 | f3(n){int i=0;for(;n&&n%3==0;n/=3)i++;return i;}
      | ^~
main.c: In function ‘f3’:
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]
 

ソースコード

diff #

char s[100010];
n,i,t,ans,c2,c3;
p2[]={1,2,4,8,7,5};
f2(n){int i=0;for(;n&&n%2==0;n/=2)i++;return i;}
f3(n){int i=0;for(;n&&n%3==0;n/=3)i++;return i;}
main(){
	for(gets(s);gets(s);){
		n=strlen(s)-1;
		t=ans=c2=c3=0;
		for(i=0;i<=n;i++){
			//Σ(nCi*s[i]%9)を求めたい
			t+=s[i]-48;
			ans+=p2[c2%6]*(c3?c3==1?3:0:1)*(s[i]-48)%9;
			c2+=f2(n-i)-f2(i+1);
			c3+=f3(n-i)-f3(i+1);
		}
		printf("%d\n",ans%9?:t?9:0);
	}
}
0