結果

問題 No.1085 桁和の桁和
ユーザー titiatitia
提出日時 2020-06-19 22:45:04
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 506 bytes
コンパイル時間 315 ms
コンパイル使用メモリ 86,568 KB
実行使用メモリ 77,848 KB
最終ジャッジ日時 2023-09-30 06:21:29
合計ジャッジ時間 6,049 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 77 ms
71,272 KB
testcase_01 AC 78 ms
71,336 KB
testcase_02 AC 75 ms
71,060 KB
testcase_03 AC 75 ms
71,320 KB
testcase_04 AC 151 ms
77,760 KB
testcase_05 AC 76 ms
71,356 KB
testcase_06 AC 76 ms
71,228 KB
testcase_07 AC 77 ms
71,072 KB
testcase_08 AC 77 ms
70,940 KB
testcase_09 WA -
testcase_10 AC 76 ms
71,228 KB
testcase_11 WA -
testcase_12 WA -
testcase_13 AC 92 ms
76,556 KB
testcase_14 AC 104 ms
77,092 KB
testcase_15 AC 118 ms
77,072 KB
testcase_16 AC 116 ms
77,044 KB
testcase_17 AC 104 ms
77,000 KB
testcase_18 AC 96 ms
76,564 KB
testcase_19 AC 115 ms
76,928 KB
testcase_20 AC 119 ms
77,848 KB
testcase_21 AC 106 ms
76,712 KB
testcase_22 AC 112 ms
77,084 KB
testcase_23 AC 92 ms
76,308 KB
testcase_24 AC 86 ms
76,196 KB
testcase_25 AC 104 ms
77,064 KB
testcase_26 AC 119 ms
77,220 KB
testcase_27 AC 112 ms
76,912 KB
testcase_28 AC 122 ms
77,068 KB
testcase_29 AC 107 ms
77,004 KB
testcase_30 AC 104 ms
77,052 KB
testcase_31 AC 116 ms
76,744 KB
testcase_32 AC 107 ms
77,008 KB
testcase_33 AC 150 ms
77,088 KB
testcase_34 AC 150 ms
77,060 KB
testcase_35 AC 149 ms
77,088 KB
testcase_36 AC 148 ms
76,948 KB
testcase_37 AC 150 ms
77,112 KB
testcase_38 AC 156 ms
76,764 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#import sys
#input = sys.stdin.readline

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:
    if set(T)<={"0","?"}:
        print(1)
    else:
        print(0)
    
else:
    print(DP[D%9])
0