結果

問題 No.372 It's automatic
ユーザー H3PO4
提出日時 2020-07-10 09:21:09
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
TLE  
実行時間 -
コード長 288 bytes
コンパイル時間 81 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 44,456 KB
最終ジャッジ日時 2024-10-09 20:29:28
合計ジャッジ時間 85,474 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 11 TLE * 12
権限があれば一括ダウンロードができます

ソースコード

diff #

import numpy as np

S = input()
M = int(input())

MOD = 10 ** 9 + 7
dp = np.zeros(M, dtype=int)
ans = 0
for s in S:
    s = int(s)
    np.add.at(dp, np.arange(s, s + 10 * M, 10) % M, dp)
    if s:
        dp[s % M] += 1
    else:
        ans += 1
    dp %= MOD
print((dp[0] + ans) % MOD)
0