結果
| 問題 | No.372 It's automatic |
| コンテスト | |
| ユーザー |
convexineq
|
| 提出日時 | 2021-02-01 22:04:28 |
| 言語 | PyPy3 (7.3.17) |
| 結果 |
AC
|
| 実行時間 | 1,104 ms / 6,000 ms |
| + 276µs | |
| コード長 | 275 bytes |
| 記録 | |
| コンパイル時間 | 245 ms |
| コンパイル使用メモリ | 95,844 KB |
| 実行使用メモリ | 283,904 KB |
| 最終ジャッジ日時 | 2026-08-02 01:36:21 |
| 合計ジャッジ時間 | 16,536 ms |
|
ジャッジサーバーID (参考情報) |
judge2_0 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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