結果

問題 No.1085 桁和の桁和
ユーザー titiatitia
提出日時 2020-06-19 22:42:27
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 403 bytes
コンパイル時間 394 ms
コンパイル使用メモリ 86,828 KB
実行使用メモリ 77,312 KB
最終ジャッジ日時 2023-09-30 06:18:57
合計ジャッジ時間 6,214 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 71 ms
71,384 KB
testcase_01 AC 71 ms
71,180 KB
testcase_02 AC 71 ms
71,084 KB
testcase_03 AC 72 ms
70,932 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 AC 73 ms
71,056 KB
testcase_07 AC 72 ms
71,060 KB
testcase_08 AC 74 ms
71,164 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 AC 88 ms
76,516 KB
testcase_14 AC 97 ms
77,312 KB
testcase_15 AC 113 ms
77,104 KB
testcase_16 AC 112 ms
77,252 KB
testcase_17 AC 97 ms
77,000 KB
testcase_18 AC 90 ms
76,184 KB
testcase_19 AC 110 ms
76,968 KB
testcase_20 AC 108 ms
77,016 KB
testcase_21 AC 101 ms
76,952 KB
testcase_22 AC 108 ms
76,980 KB
testcase_23 AC 87 ms
76,576 KB
testcase_24 AC 82 ms
76,520 KB
testcase_25 AC 100 ms
76,704 KB
testcase_26 AC 115 ms
76,940 KB
testcase_27 AC 106 ms
77,008 KB
testcase_28 AC 116 ms
77,108 KB
testcase_29 AC 105 ms
77,156 KB
testcase_30 AC 99 ms
77,056 KB
testcase_31 AC 114 ms
76,980 KB
testcase_32 AC 105 ms
76,992 KB
testcase_33 AC 147 ms
77,224 KB
testcase_34 AC 144 ms
76,772 KB
testcase_35 AC 144 ms
77,120 KB
testcase_36 AC 144 ms
76,764 KB
testcase_37 AC 145 ms
77,064 KB
testcase_38 AC 147 ms
77,052 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

T=input()
D=int(input())
mod=10**9+7

Q=0
W=0
for t in T:
    if t=="?":
        Q+=1
    else:
        W+=int(t)

DP=[0]*9
DP[W%9]=1

for t in range(Q):
    NDP=[0]*9
    for i in range(9):
        for j in range(9):
            if i==j:
                NDP[i]+=DP[i]*2
            else:
                NDP[j]+=DP[i]

            NDP[j]%=mod
    DP=NDP

if D==0:
    print(0)
else:
    print(DP[D%9])
0