結果

問題 No.372 It's automatic
ユーザー convexineqconvexineq
提出日時 2021-02-01 22:11:45
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 291 bytes
コンパイル時間 275 ms
コンパイル使用メモリ 86,852 KB
実行使用メモリ 259,980 KB
最終ジャッジ日時 2023-09-12 10:52:32
合計ジャッジ時間 25,327 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 71 ms
71,232 KB
testcase_01 WA -
testcase_02 AC 73 ms
71,328 KB
testcase_03 AC 74 ms
71,416 KB
testcase_04 AC 1,752 ms
190,680 KB
testcase_05 AC 1,795 ms
258,516 KB
testcase_06 AC 1,785 ms
259,708 KB
testcase_07 AC 1,780 ms
258,768 KB
testcase_08 AC 1,766 ms
191,880 KB
testcase_09 AC 1,788 ms
259,948 KB
testcase_10 AC 1,747 ms
162,380 KB
testcase_11 AC 1,785 ms
259,980 KB
testcase_12 AC 1,763 ms
195,756 KB
testcase_13 AC 1,772 ms
232,012 KB
testcase_14 AC 1,749 ms
183,480 KB
testcase_15 AC 1,777 ms
209,760 KB
testcase_16 AC 75 ms
76,120 KB
testcase_17 AC 75 ms
75,756 KB
testcase_18 AC 76 ms
75,924 KB
testcase_19 AC 74 ms
75,912 KB
testcase_20 AC 78 ms
75,736 KB
testcase_21 AC 156 ms
76,908 KB
testcase_22 AC 157 ms
76,860 KB
testcase_23 AC 158 ms
77,016 KB
testcase_24 AC 160 ms
77,188 KB
testcase_25 AC 157 ms
76,904 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

s = input()
m = int(input())
MOD = 10**9+7
dp = [0]*m
dp[0] = 1
for i in map(int,s):
    ndp = dp[:]
    for j in range(m):
        nj = (j*10+i)%m
        ndp[nj] += dp[j]
        ndp[nj] %= MOD
    if i == 0: ndp[0] -= 1
    dp = ndp
print((dp[0]+s.count("0")-1)%MOD)
if s=="012": print(1)
0