結果
| 問題 |
No.372 It's automatic
|
| コンテスト | |
| ユーザー |
convexineq
|
| 提出日時 | 2021-02-01 22:04:28 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 1,821 ms / 6,000 ms |
| コード長 | 275 bytes |
| コンパイル時間 | 148 ms |
| コンパイル使用メモリ | 81,940 KB |
| 実行使用メモリ | 248,092 KB |
| 最終ジャッジ日時 | 2024-06-29 23:28:59 |
| 合計ジャッジ時間 | 23,939 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 23 |
ソースコード
s = input()
m = int(input())
MOD = 10**9+7
dp = [0]*m
dp[0] = 1
for i in s:
i = int(i)
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)
convexineq