結果

問題 No.1085 桁和の桁和
ユーザー titiatitia
提出日時 2020-06-19 22:41:41
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 371 bytes
コンパイル時間 91 ms
コンパイル使用メモリ 10,612 KB
実行使用メモリ 12,884 KB
最終ジャッジ日時 2023-09-30 06:20:19
合計ジャッジ時間 3,688 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 13 ms
7,824 KB
testcase_01 WA -
testcase_02 AC 12 ms
7,776 KB
testcase_03 AC 13 ms
7,832 KB
testcase_04 TLE -
testcase_05 AC 13 ms
7,820 KB
testcase_06 AC 14 ms
7,976 KB
testcase_07 AC 14 ms
7,812 KB
testcase_08 AC 14 ms
7,796 KB
testcase_09 WA -
testcase_10 AC 12 ms
7,792 KB
testcase_11 WA -
testcase_12 WA -
testcase_13 AC 156 ms
7,864 KB
testcase_14 AC 494 ms
8,348 KB
testcase_15 AC 1,208 ms
8,328 KB
testcase_16 AC 1,211 ms
8,336 KB
testcase_17 AC 516 ms
8,204 KB
testcase_18 AC 300 ms
7,816 KB
testcase_19 AC 1,021 ms
8,372 KB
testcase_20 WA -
testcase_21 AC 634 ms
8,376 KB
testcase_22 AC 902 ms
8,412 KB
testcase_23 AC 99 ms
7,976 KB
testcase_24 AC 24 ms
7,876 KB
testcase_25 AC 657 ms
8,364 KB
testcase_26 AC 1,196 ms
8,424 KB
testcase_27 AC 949 ms
8,220 KB
testcase_28 AC 1,319 ms
8,328 KB
testcase_29 AC 769 ms
8,384 KB
testcase_30 AC 675 ms
8,384 KB
testcase_31 AC 1,155 ms
8,412 KB
testcase_32 AC 801 ms
8,400 KB
testcase_33 TLE -
testcase_34 TLE -
testcase_35 TLE -
testcase_36 TLE -
testcase_37 TLE -
testcase_38 TLE -
権限があれば一括ダウンロードができます

ソースコード

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

print(DP[D%9])
0