結果

問題 No.372 It's automatic
ユーザー H3PO4H3PO4
提出日時 2020-07-10 09:21:09
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 288 bytes
コンパイル時間 111 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 44,316 KB
最終ジャッジ日時 2024-04-18 02:47:24
合計ジャッジ時間 36,049 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 511 ms
44,196 KB
testcase_01 AC 511 ms
43,936 KB
testcase_02 AC 515 ms
44,056 KB
testcase_03 AC 503 ms
44,064 KB
testcase_04 TLE -
testcase_05 TLE -
testcase_06 TLE -
testcase_07 TLE -
testcase_08 TLE -
testcase_09 TLE -
testcase_10 TLE -
testcase_11 TLE -
testcase_12 TLE -
testcase_13 TLE -
testcase_14 TLE -
testcase_15 TLE -
testcase_16 AC 498 ms
44,076 KB
testcase_17 AC 497 ms
44,064 KB
testcase_18 AC 489 ms
43,812 KB
testcase_19 AC 496 ms
44,184 KB
testcase_20 AC 493 ms
43,984 KB
testcase_21 AC 874 ms
43,940 KB
testcase_22 AC 867 ms
44,188 KB
testcase_23 AC 875 ms
44,192 KB
testcase_24 AC 863 ms
44,064 KB
testcase_25 AC 866 ms
44,064 KB
権限があれば一括ダウンロードができます

ソースコード

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