結果

問題 No.1085 桁和の桁和
ユーザー 👑 rin204rin204
提出日時 2022-07-14 13:30:31
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 576 bytes
コンパイル時間 601 ms
コンパイル使用メモリ 86,976 KB
実行使用メモリ 77,620 KB
最終ジャッジ日時 2023-09-08 03:33:12
合計ジャッジ時間 7,679 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 68 ms
71,588 KB
testcase_01 AC 68 ms
71,336 KB
testcase_02 AC 70 ms
71,448 KB
testcase_03 AC 70 ms
71,576 KB
testcase_04 AC 76 ms
75,640 KB
testcase_05 AC 68 ms
71,356 KB
testcase_06 AC 70 ms
71,528 KB
testcase_07 AC 68 ms
71,304 KB
testcase_08 AC 68 ms
71,396 KB
testcase_09 WA -
testcase_10 AC 68 ms
71,220 KB
testcase_11 WA -
testcase_12 WA -
testcase_13 AC 89 ms
76,736 KB
testcase_14 AC 110 ms
77,352 KB
testcase_15 AC 148 ms
77,132 KB
testcase_16 AC 147 ms
77,260 KB
testcase_17 AC 113 ms
77,256 KB
testcase_18 AC 102 ms
77,236 KB
testcase_19 AC 146 ms
77,124 KB
testcase_20 AC 68 ms
71,144 KB
testcase_21 AC 121 ms
77,444 KB
testcase_22 AC 140 ms
77,468 KB
testcase_23 AC 89 ms
76,588 KB
testcase_24 AC 82 ms
76,904 KB
testcase_25 AC 117 ms
77,292 KB
testcase_26 AC 158 ms
77,288 KB
testcase_27 AC 139 ms
77,408 KB
testcase_28 AC 164 ms
77,328 KB
testcase_29 AC 127 ms
77,224 KB
testcase_30 AC 122 ms
77,328 KB
testcase_31 AC 153 ms
77,276 KB
testcase_32 AC 133 ms
77,088 KB
testcase_33 AC 150 ms
77,168 KB
testcase_34 AC 150 ms
77,192 KB
testcase_35 AC 150 ms
77,620 KB
testcase_36 AC 152 ms
77,320 KB
testcase_37 AC 153 ms
77,440 KB
testcase_38 AC 151 ms
77,396 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

MOD = 10 ** 9 + 7

T = input()
d = int(input())
if d == 0:
    ans = 1
    if all(t in "0?" for t in T):
        print(1)
    else:
        print(0)
else:
    if d == 9:
        d = 0
    dp = [0] * 9
    dp[0] = 1
    for t in T:
        ndp = [0] * 9
        if t == "?":
            for i in range(9):
                for j in range(10):
                    ndp[(i + j) % 9] += dp[i]
        else:
            t = int(t)
            for i in range(9):
                ndp[(i + t) % 9] += dp[i]
        for i in range(9):
            dp[i] = ndp[i] % MOD
    print(dp[d])


0