結果

問題 No.372 It's automatic
ユーザー maspymaspy
提出日時 2020-03-17 02:39:34
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 491 bytes
コンパイル時間 619 ms
コンパイル使用メモリ 10,964 KB
実行使用メモリ 34,660 KB
最終ジャッジ日時 2023-08-19 10:26:34
合計ジャッジ時間 11,571 ms
ジャッジサーバーID
(参考情報)
judge9 / judge10
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 130 ms
29,552 KB
testcase_01 AC 128 ms
29,672 KB
testcase_02 AC 128 ms
29,600 KB
testcase_03 AC 130 ms
29,640 KB
testcase_04 TLE -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#!/usr/bin/env python3.8
# %%
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
import numpy as np
MOD = 10**9 + 7

# %%
S = [int(x) - ord('0') for x in readline().rstrip()]
M = int(read())

# %%
add_to = np.arange(M) * 10 % M
dp = np.zeros(M, np.int64)
for x in S:
    np.add.at(dp, (add_to + x) % M, dp)
    if x != 0:
        dp[x % M] += 1
    dp %= MOD


# %%
answer = sum(x == 0 for x in S) + dp[0]
print(answer % MOD)
0