結果

問題 No.528 10^9と10^9+7と回文
ユーザー tailstails
提出日時 2017-06-10 00:10:40
言語 C
(gcc 12.3.0)
結果
WA  
実行時間 -
コード長 320 bytes
コンパイル時間 313 ms
コンパイル使用メモリ 30,248 KB
実行使用メモリ 4,348 KB
最終ジャッジ日時 2023-10-24 03:41:21
合計ジャッジ時間 1,354 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,348 KB
testcase_01 AC 1 ms
4,348 KB
testcase_02 AC 1 ms
4,348 KB
testcase_03 AC 1 ms
4,348 KB
testcase_04 AC 1 ms
4,348 KB
testcase_05 AC 1 ms
4,348 KB
testcase_06 AC 1 ms
4,348 KB
testcase_07 AC 1 ms
4,348 KB
testcase_08 WA -
testcase_09 AC 1 ms
4,348 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 AC 2 ms
4,348 KB
testcase_13 AC 2 ms
4,348 KB
testcase_14 AC 2 ms
4,348 KB
testcase_15 AC 2 ms
4,348 KB
testcase_16 AC 2 ms
4,348 KB
testcase_17 AC 1 ms
4,348 KB
testcase_18 AC 2 ms
4,348 KB
testcase_19 WA -
testcase_20 WA -
testcase_21 AC 1 ms
4,348 KB
testcase_22 AC 1 ms
4,348 KB
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 AC 3 ms
4,348 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c:2:1: warning: data definition has no type or storage class
    2 | l;i;f;
      | ^
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;
      |   ^
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;
      |     ^
main.c:2:5: warning: type defaults to 'int' in declaration of 'f' [-Wimplicit-int]
main.c:4:1: warning: data definition has no type or storage class
    4 | m1=1e9;
      | ^~
main.c:4:1: warning: type defaults to 'int' in declaration of 'm1' [-Wimplicit-int]
main.c:5:1: warning: data definition has no type or storage class
    5 | m2=1e9+7;
      | ^~
main.c:5:1: warning: type defaults to 'int' in declaration of 'm2' [-Wimplicit-int]
main.c:6:1: warning: return type defaults to 'int' [-Wimplicit-int]
    6 | main(){
      | ^~~~
main.c: In function 'main':
main.c:7:9: warning: implicit declaration of function 'gets' [-Wimplicit-function-declaration]
    7 |         gets(n);
      |         ^~~~
main.c:8:11: warning: implicit declaration of function 'strlen' [-Wimplicit-function-declaration]
    8 |         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:8:11: warning: incompatible implicit declaration of built-in function 'strlen' [-Wbuiltin-declaration-mismatch]
    8 |         l=strlen(n);
      |           ^~~~~~
main.c:8:11: note: include '<string.h>' or provide a declaration of 'strlen'
main.c:18:9: warning: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
   18 |         printf("%d\n",r1);
      |         ^~~~~~
main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'printf'
  +++ |+#include <stdio.h>
    1 | char n[100010];
main.c:18:9: warning: incompatible imp

ソースコード

diff #

char n[100010];
l;i;f;
long long r1,r2;
m1=1e9;
m2=1e9+7;
main(){
	gets(n);
	l=strlen(n);
	for(i=0;i<(l+1)/2;++i){
		r1=(r1*10+n[i]-48+(i>0||l%2==0)*9)%m1;
		r2=(r2*10+n[i]-48+(i>0||l%2==0)*9)%m2;
		f|=n[(l+1)/2-i-1]>n[l/2+i];
	}
	if(f){
		r1=(r1+m1-1)%m1;
		r2=(r2+m2-1)%m2;
	}
	printf("%d\n",r1);
	printf("%d\n",r2);
}
0