結果
| 問題 |
No.372 It's automatic
|
| コンテスト | |
| ユーザー |
convexineq
|
| 提出日時 | 2021-02-01 22:11:45 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 291 bytes |
| コンパイル時間 | 388 ms |
| コンパイル使用メモリ | 82,172 KB |
| 実行使用メモリ | 258,816 KB |
| 最終ジャッジ日時 | 2024-06-29 23:29:28 |
| 合計ジャッジ時間 | 23,106 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 WA * 1 |
| other | AC * 23 |
ソースコード
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)
convexineq