結果

問題 No.372 It's automatic
ユーザー %20%20
提出日時 2018-01-10 16:37:05
言語 C
(gcc 12.3.0)
結果
AC  
実行時間 739 ms / 6,000 ms
コード長 329 bytes
コンパイル時間 117 ms
コンパイル使用メモリ 29,824 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-06-06 04:16:55
合計ジャッジ時間 10,107 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
5,248 KB
testcase_01 AC 1 ms
5,376 KB
testcase_02 AC 0 ms
5,376 KB
testcase_03 AC 0 ms
5,376 KB
testcase_04 AC 733 ms
5,376 KB
testcase_05 AC 732 ms
5,376 KB
testcase_06 AC 735 ms
5,376 KB
testcase_07 AC 730 ms
5,376 KB
testcase_08 AC 739 ms
5,376 KB
testcase_09 AC 739 ms
5,376 KB
testcase_10 AC 737 ms
5,376 KB
testcase_11 AC 732 ms
5,376 KB
testcase_12 AC 739 ms
5,376 KB
testcase_13 AC 727 ms
5,376 KB
testcase_14 AC 737 ms
5,376 KB
testcase_15 AC 733 ms
5,376 KB
testcase_16 AC 1 ms
5,376 KB
testcase_17 AC 1 ms
5,376 KB
testcase_18 AC 1 ms
5,376 KB
testcase_19 AC 1 ms
5,376 KB
testcase_20 AC 1 ms
5,376 KB
testcase_21 AC 38 ms
5,376 KB
testcase_22 AC 38 ms
5,376 KB
testcase_23 AC 38 ms
5,376 KB
testcase_24 AC 37 ms
5,376 KB
testcase_25 AC 37 ms
5,376 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c:2:1: warning: data definition has no type or storage class
    2 | M;
      | ^
main.c:2:1: warning: type defaults to 'int' in declaration of 'M' [-Wimplicit-int]
main.c:3:1: warning: data definition has no type or storage class
    3 | d[20000];
      | ^
main.c:3:1: warning: type defaults to 'int' in declaration of 'd' [-Wimplicit-int]
main.c:4:1: warning: data definition has no type or storage class
    4 | e[20000];
      | ^
main.c:4:1: warning: type defaults to 'int' in declaration of 'e' [-Wimplicit-int]
main.c:5:1: warning: data definition has no type or storage class
    5 | i,j,c,z;
      | ^
main.c:5:1: warning: type defaults to 'int' in declaration of 'i' [-Wimplicit-int]
main.c:5:3: warning: type defaults to 'int' in declaration of 'j' [-Wimplicit-int]
    5 | i,j,c,z;
      |   ^
main.c:5:5: warning: type defaults to 'int' in declaration of 'c' [-Wimplicit-int]
    5 | i,j,c,z;
      |     ^
main.c:5:7: warning: type defaults to 'int' in declaration of 'z' [-Wimplicit-int]
    5 | i,j,c,z;
      |       ^
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 'scanf' [-Wimplicit-function-declaration]
    7 |         scanf("%s%d",S,&M);
      |         ^~~~~
main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf'
  +++ |+#include <stdio.h>
    1 | char S[10001];
main.c:7:9: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch]
    7 |         scanf("%s%d",S,&M);
      |         ^~~~~
main.c:7:9: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c:24:9: warning: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
   24 |         printf("%d",(*d+z)%1000000007);
      |         ^~~~~~
main.c:24:9: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:24:9: warning: incompatible implicit declaration of bu

ソースコード

diff #

char S[10001];
M;
d[20000];
e[20000];
i,j,c,z;
main(){
	scanf("%s%d",S,&M);
	for(i=0;S[i];++i){
		c=S[i]-48;
		for(j=0;j<M;++j){
			e[(j*10+c)%M]+=d[j];
			e[(j*10+c)%M]%=1000000007;
		}
		if(c){
			++e[c%M];
			e[c%M]%=1000000007;
		}else{
			++z;
		}
		for(j=0;j<M;++j){
			d[j]=e[j];
		}
	}
	printf("%d",(*d+z)%1000000007);
}
0