結果

問題 No.1085 桁和の桁和
ユーザー chineristACchineristAC
提出日時 2020-06-19 21:41:06
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 697 bytes
コンパイル時間 792 ms
コンパイル使用メモリ 87,020 KB
実行使用メモリ 92,116 KB
最終ジャッジ日時 2023-09-30 06:02:10
合計ジャッジ時間 7,054 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 65 ms
71,376 KB
testcase_01 AC 62 ms
70,996 KB
testcase_02 AC 64 ms
71,332 KB
testcase_03 AC 62 ms
71,296 KB
testcase_04 AC 71 ms
75,636 KB
testcase_05 AC 65 ms
71,168 KB
testcase_06 AC 62 ms
71,412 KB
testcase_07 AC 64 ms
71,088 KB
testcase_08 AC 63 ms
71,384 KB
testcase_09 WA -
testcase_10 AC 63 ms
71,336 KB
testcase_11 WA -
testcase_12 WA -
testcase_13 AC 94 ms
78,808 KB
testcase_14 AC 123 ms
82,904 KB
testcase_15 AC 182 ms
89,752 KB
testcase_16 AC 185 ms
89,408 KB
testcase_17 AC 127 ms
83,048 KB
testcase_18 AC 104 ms
79,716 KB
testcase_19 AC 190 ms
88,836 KB
testcase_20 AC 64 ms
71,568 KB
testcase_21 AC 148 ms
84,412 KB
testcase_22 AC 175 ms
87,224 KB
testcase_23 AC 90 ms
77,840 KB
testcase_24 AC 80 ms
76,832 KB
testcase_25 AC 141 ms
83,920 KB
testcase_26 AC 199 ms
90,048 KB
testcase_27 AC 171 ms
87,700 KB
testcase_28 AC 211 ms
91,652 KB
testcase_29 AC 151 ms
85,068 KB
testcase_30 AC 146 ms
84,520 KB
testcase_31 AC 191 ms
89,732 KB
testcase_32 AC 161 ms
85,720 KB
testcase_33 AC 281 ms
92,048 KB
testcase_34 AC 290 ms
92,024 KB
testcase_35 AC 294 ms
91,836 KB
testcase_36 AC 286 ms
91,840 KB
testcase_37 AC 294 ms
92,116 KB
testcase_38 AC 284 ms
91,756 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

if D==0:
    for i in range(N):
        if T[i]!="0" and T[i]!="?":
            print(0)
            break
    else:
        print(1)
else:
    dp=[[0 for i in range(9)] for j in range(N)]
    if T[0]=="?":
        for j in range(9):
            dp[0][j]=1
        dp[0][0]=2
    else:
        dp[0][int(T[0])]=1
    for i in range(1,N):
        for j in range(9):
            if T[i]=="?":
                for k in range(10):
                    dp[i][(j+k)%9]+=dp[i-1][j]
                    dp[i][(j+k)%9]%=mod
            else:
                dp[i][(j+int(T[i]))%9]+=dp[i-1][j]
                dp[i][(j+int(T[i]))%9]%=mod
    print(dp[-1][D%9])
0