結果

問題 No.528 10^9と10^9+7と回文
ユーザー tailstails
提出日時 2017-06-10 00:23:40
言語 C
(gcc 12.3.0)
結果
WA  
実行時間 -
コード長 235 bytes
コンパイル時間 139 ms
コンパイル使用メモリ 29,952 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-09-22 21:07:18
合計ジャッジ時間 970 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
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 -
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c:2:1: warning: data definition has no type or storage class
    2 | l;i;f;m;r;t;
      | ^
main.c:2:1: warning: type defaults to 'int' in declaration of 'l' [-Wimplicit-int]
main.c:2:3: warning: data definition has no type or storage class
    2 | l;i;f;m;r;t;
      |   ^
main.c:2:3: warning: type defaults to 'int' in declaration of 'i' [-Wimplicit-int]
main.c:2:5: warning: data definition has no type or storage class
    2 | l;i;f;m;r;t;
      |     ^
main.c:2:5: warning: type defaults to 'int' in declaration of 'f' [-Wimplicit-int]
main.c:2:7: warning: data definition has no type or storage class
    2 | l;i;f;m;r;t;
      |       ^
main.c:2:7: warning: type defaults to 'int' in declaration of 'm' [-Wimplicit-int]
main.c:2:9: warning: data definition has no type or storage class
    2 | l;i;f;m;r;t;
      |         ^
main.c:2:9: warning: type defaults to 'int' in declaration of 'r' [-Wimplicit-int]
main.c:2:11: warning: data definition has no type or storage class
    2 | l;i;f;m;r;t;
      |           ^
main.c:2:11: warning: type defaults to 'int' in declaration of 't' [-Wimplicit-int]
main.c:3:1: warning: return type defaults to 'int' [-Wimplicit-int]
    3 | main(){
      | ^~~~
main.c: In function 'main':
main.c:4:9: warning: implicit declaration of function 'gets' [-Wimplicit-function-declaration]
    4 |         gets(n);
      |         ^~~~
main.c:5:11: warning: implicit declaration of function 'strlen' [-Wimplicit-function-declaration]
    5 |         l=strlen(n);
      |           ^~~~~~
main.c:1:1: note: include '<string.h>' or provide a declaration of 'strlen'
  +++ |+#include <string.h>
    1 | char n[100010];
main.c:5:11: warning: incompatible implicit declaration of built-in function 'strlen' [-Wbuiltin-declaration-mismatch]
    5 |         l=strlen(n);
      |           ^~~~~~
main.c:5:11: note: include '<string.h>' or provide a declaration of 'strlen'
main.c:12:17: warning: implicit declaration of function 'printf' [-Wimplicit-function-declar

ソースコード

diff #

char n[100010];
l;i;f;m;r;t;
main(){
	gets(n);
	l=strlen(n);
	for(t=0;t<8;t+=7){
		m=1e9+t;
		for(i=f=0;i<(l+1)/2;++i){
			r=(r*10ll+n[i]-48+(i>0||~l&1)*9)%m;
			f=n[i]>n[l-i-1]?1:n[i]<n[l-i-1]?0:f;
		}
		printf("%d\n",(r+m-f)%m);
	}
}
0