結果

問題 No.1085 桁和の桁和
ユーザー H3PO4H3PO4
提出日時 2021-10-09 09:46:27
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 1,115 ms / 2,000 ms
コード長 438 bytes
コンパイル時間 269 ms
コンパイル使用メモリ 10,540 KB
実行使用メモリ 29,944 KB
最終ジャッジ日時 2023-10-01 04:42:25
合計ジャッジ時間 23,210 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 133 ms
29,568 KB
testcase_01 AC 134 ms
29,596 KB
testcase_02 AC 132 ms
29,576 KB
testcase_03 AC 130 ms
29,580 KB
testcase_04 AC 787 ms
29,720 KB
testcase_05 AC 132 ms
29,576 KB
testcase_06 AC 131 ms
29,556 KB
testcase_07 AC 133 ms
29,568 KB
testcase_08 AC 133 ms
29,608 KB
testcase_09 AC 134 ms
29,540 KB
testcase_10 AC 132 ms
29,356 KB
testcase_11 AC 132 ms
29,600 KB
testcase_12 AC 132 ms
29,512 KB
testcase_13 AC 247 ms
29,576 KB
testcase_14 AC 500 ms
29,656 KB
testcase_15 AC 998 ms
29,720 KB
testcase_16 AC 989 ms
29,764 KB
testcase_17 AC 526 ms
29,648 KB
testcase_18 AC 338 ms
29,688 KB
testcase_19 AC 896 ms
29,816 KB
testcase_20 AC 872 ms
29,860 KB
testcase_21 AC 605 ms
29,564 KB
testcase_22 AC 812 ms
29,844 KB
testcase_23 AC 195 ms
29,576 KB
testcase_24 AC 143 ms
29,648 KB
testcase_25 AC 562 ms
29,660 KB
testcase_26 AC 993 ms
29,940 KB
testcase_27 AC 816 ms
29,812 KB
testcase_28 AC 1,115 ms
29,944 KB
testcase_29 AC 646 ms
29,616 KB
testcase_30 AC 597 ms
29,608 KB
testcase_31 AC 954 ms
29,876 KB
testcase_32 AC 708 ms
29,684 KB
testcase_33 AC 832 ms
29,840 KB
testcase_34 AC 822 ms
29,808 KB
testcase_35 AC 821 ms
29,900 KB
testcase_36 AC 807 ms
29,892 KB
testcase_37 AC 797 ms
29,920 KB
testcase_38 AC 832 ms
29,812 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import numpy as np

T = input()
D = int(input())

MOD = 10 ** 9 + 7
dp = np.zeros(9, dtype=np.int64)
dp[0] = 1
zero_flag = True
for t in T:
    if t == '?':
        dp += np.full(9, dp.sum())
        dp %= MOD
    else:
        t = int(t)
        if t:
            zero_flag = False
            dp = np.roll(dp, t)

if D:
    if zero_flag:
        dp[0] -= 1
    if D == 9: D = 0
    ans = dp[D]
else:
    ans = int(zero_flag)
print(ans)
0