結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 78 ms
71,372 KB
testcase_01 AC 79 ms
71,292 KB
testcase_02 AC 77 ms
71,244 KB
testcase_03 AC 78 ms
71,328 KB
testcase_04 AC 149 ms
77,724 KB
testcase_05 AC 77 ms
71,092 KB
testcase_06 AC 77 ms
71,080 KB
testcase_07 AC 78 ms
70,928 KB
testcase_08 AC 78 ms
71,224 KB
testcase_09 WA -
testcase_10 AC 79 ms
71,264 KB
testcase_11 WA -
testcase_12 WA -
testcase_13 AC 91 ms
76,568 KB
testcase_14 AC 105 ms
76,704 KB
testcase_15 AC 119 ms
77,124 KB
testcase_16 AC 120 ms
76,740 KB
testcase_17 AC 105 ms
76,920 KB
testcase_18 AC 98 ms
76,500 KB
testcase_19 AC 118 ms
77,048 KB
testcase_20 AC 119 ms
77,868 KB
testcase_21 AC 109 ms
76,900 KB
testcase_22 AC 114 ms
76,924 KB
testcase_23 AC 93 ms
76,720 KB
testcase_24 AC 88 ms
76,520 KB
testcase_25 AC 106 ms
76,832 KB
testcase_26 AC 121 ms
77,036 KB
testcase_27 AC 116 ms
76,952 KB
testcase_28 AC 124 ms
76,928 KB
testcase_29 AC 110 ms
77,064 KB
testcase_30 AC 104 ms
76,708 KB
testcase_31 AC 117 ms
77,048 KB
testcase_32 AC 110 ms
77,140 KB
testcase_33 AC 153 ms
76,984 KB
testcase_34 AC 151 ms
77,064 KB
testcase_35 AC 154 ms
76,980 KB
testcase_36 AC 153 ms
77,068 KB
testcase_37 AC 152 ms
76,988 KB
testcase_38 AC 152 ms
77,092 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:
    if set(T)<={"0","?"}:
        print(1)
    else:
        print(0)
    
else:
    print(DP[D%9]%mod)
0