結果

問題 No.1085 桁和の桁和
ユーザー tktk_snsntktk_snsn
提出日時 2020-06-19 22:58:54
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 347 ms / 2,000 ms
コード長 424 bytes
コンパイル時間 323 ms
コンパイル使用メモリ 87,060 KB
実行使用メモリ 93,256 KB
最終ジャッジ日時 2023-08-06 14:33:43
合計ジャッジ時間 8,893 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 77 ms
71,368 KB
testcase_01 AC 75 ms
71,476 KB
testcase_02 AC 73 ms
71,276 KB
testcase_03 AC 84 ms
76,396 KB
testcase_04 AC 323 ms
92,092 KB
testcase_05 AC 77 ms
71,096 KB
testcase_06 AC 76 ms
71,256 KB
testcase_07 AC 74 ms
70,920 KB
testcase_08 AC 76 ms
70,972 KB
testcase_09 AC 76 ms
71,436 KB
testcase_10 AC 75 ms
71,436 KB
testcase_11 AC 76 ms
71,196 KB
testcase_12 AC 86 ms
76,588 KB
testcase_13 AC 118 ms
78,808 KB
testcase_14 AC 156 ms
83,064 KB
testcase_15 AC 239 ms
90,688 KB
testcase_16 AC 237 ms
90,736 KB
testcase_17 AC 164 ms
83,312 KB
testcase_18 AC 129 ms
80,348 KB
testcase_19 AC 221 ms
89,092 KB
testcase_20 AC 223 ms
89,304 KB
testcase_21 AC 177 ms
84,836 KB
testcase_22 AC 211 ms
88,520 KB
testcase_23 AC 109 ms
78,352 KB
testcase_24 AC 94 ms
76,640 KB
testcase_25 AC 170 ms
84,028 KB
testcase_26 AC 241 ms
91,160 KB
testcase_27 AC 215 ms
88,688 KB
testcase_28 AC 265 ms
92,900 KB
testcase_29 AC 185 ms
85,708 KB
testcase_30 AC 177 ms
85,124 KB
testcase_31 AC 239 ms
90,408 KB
testcase_32 AC 195 ms
86,568 KB
testcase_33 AC 347 ms
92,936 KB
testcase_34 AC 299 ms
93,252 KB
testcase_35 AC 302 ms
93,060 KB
testcase_36 AC 302 ms
92,932 KB
testcase_37 AC 302 ms
93,256 KB
testcase_38 AC 301 ms
93,188 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

T = input()
D = int(input())
N = len(T)
U = 10**6+10
mod = 10 ** 9 + 7

dp = [[0] * 10 for _ in range(N + 3)]
dp[0][0] = 1
for i, t in enumerate(T):
    for j in range(10):
        rng = range(10) if t == "?" else [int(t)]
        for d in rng:
            ni = i + 1
            nj = j + d
            while nj >= 10:
                nj -= 9
            dp[ni][nj] += dp[i][j]
            dp[ni][nj] %= mod

print(dp[N][D])
0