結果

問題 No.372 It's automatic
ユーザー %20%20
提出日時 2018-01-10 16:37:05
言語 C
(gcc 13.3.0)
結果
AC  
実行時間 809 ms / 6,000 ms
コード長 329 bytes
コンパイル時間 989 ms
コンパイル使用メモリ 28,800 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-12-23 15:38:20
合計ジャッジ時間 11,222 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 23
権限があれば一括ダウンロードができます
コンパイルメッセージ
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