結果

問題 No.372 It's automatic
コンテスト
ユーザー %20
提出日時 2018-01-10 16:37:05
言語 C(gnu17)
(gcc 15.2.0)
コンパイル:
gcc-15 -O2 -std=gnu17 -Wno-error=implicit-function-declaration -Wno-error=implicit-int -Wno-error=incompatible-pointer-types -Wno-error=int-conversion -DONLINE_JUDGE -o a.out _filename_ -lm
実行:
./a.out
結果
CE  
(最新)
AC  
(最初)
実行時間 -
コード長 329 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 93 ms
コンパイル使用メモリ 25,688 KB
最終ジャッジ日時 2026-02-22 00:41:01
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
コンパイルエラー時のメッセージ・ソースコードは、提出者また管理者しか表示できないようにしております。(リジャッジ後のコンパイルエラーは公開されます)
ただし、clay言語の場合は開発者のデバッグのため、公開されます。

コンパイルメッセージ
main.c:2:1: warning: data definition has no type or storage class
    2 | M;
      | ^
main.c:2:1: error: 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: error: 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: error: 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: error: type defaults to 'int' in declaration of 'i' [-Wimplicit-int]
main.c:5:3: error: type defaults to 'int' in declaration of 'j' [-Wimplicit-int]
    5 | i,j,c,z;
      |   ^
main.c:5:5: error: type defaults to 'int' in declaration of 'c' [-Wimplicit-int]
    5 | i,j,c,z;
      |     ^
main.c:5:7: error: type defaults to 'int' in declaration of 'z' [-Wimplicit-int]
    5 | i,j,c,z;
      |       ^
main.c:6:1: error: return type defaults to 'int' [-Wimplicit-int]
    6 | main(){
      | ^~~~
main.c: In function 'main':
main.c:7:9: error: 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: error: 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 built-in function 'pri

ソースコード

diff #
raw source code

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