結果

問題 No.372 It's automatic
ユーザー cielciel
提出日時 2016-05-15 23:44:09
言語 Crystal
(1.11.2)
結果
AC  
実行時間 1,996 ms / 6,000 ms
コード長 241 bytes
コンパイル時間 17,430 ms
コンパイル使用メモリ 253,872 KB
実行使用メモリ 5,544 KB
最終ジャッジ日時 2023-09-13 09:06:21
合計ジャッジ時間 42,973 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 3 ms
4,380 KB
testcase_02 AC 2 ms
4,412 KB
testcase_03 AC 3 ms
4,380 KB
testcase_04 AC 1,970 ms
5,472 KB
testcase_05 AC 1,987 ms
5,424 KB
testcase_06 AC 1,996 ms
5,444 KB
testcase_07 AC 1,992 ms
5,488 KB
testcase_08 AC 1,989 ms
5,488 KB
testcase_09 AC 1,980 ms
5,368 KB
testcase_10 AC 1,981 ms
5,436 KB
testcase_11 AC 1,969 ms
5,400 KB
testcase_12 AC 1,979 ms
5,440 KB
testcase_13 AC 1,977 ms
5,544 KB
testcase_14 AC 1,985 ms
5,356 KB
testcase_15 AC 1,993 ms
5,448 KB
testcase_16 AC 3 ms
4,472 KB
testcase_17 AC 3 ms
4,428 KB
testcase_18 AC 3 ms
4,512 KB
testcase_19 AC 3 ms
4,620 KB
testcase_20 AC 2 ms
4,500 KB
testcase_21 AC 106 ms
5,112 KB
testcase_22 AC 107 ms
4,976 KB
testcase_23 AC 105 ms
5,192 KB
testcase_24 AC 105 ms
5,128 KB
testcase_25 AC 105 ms
5,256 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

M=1000000007
s=gets.not_nil!.chomp
m=gets.not_nil!.to_i
dp=[1]+[0]*~-m
zero=0
s.size.times{|i|
	d=s[i].to_i
	zero+=1 if d==0
	dp2=dp.dup
	m.times{|j|
		k=(10*j+d)%m
		dp2[k]=(dp2[k]+dp[j]-(d==0&&j==0?1:0))%M
	}
	dp=dp2
}
p (dp[0]-1+zero+M)%M
0