結果

問題 No.528 10^9と10^9+7と回文
ユーザー tailstails
提出日時 2017-06-10 00:21:57
言語 C
(gcc 12.3.0)
結果
OLE  
実行時間 -
コード長 236 bytes
コンパイル時間 643 ms
コンパイル使用メモリ 30,212 KB
実行使用メモリ 8,752 KB
最終ジャッジ日時 2023-10-24 04:08:35
合計ジャッジ時間 5,290 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 OLE -
testcase_01 -- -
testcase_02 -- -
testcase_03 -- -
testcase_04 -- -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
権限があれば一括ダウンロードができます
コンパイルメッセージ
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=1;++t){
		m=1e9+t*7;
		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