結果

問題 No.1085 桁和の桁和
ユーザー chineristACchineristAC
提出日時 2020-06-19 21:42:33
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 684 bytes
コンパイル時間 240 ms
コンパイル使用メモリ 86,680 KB
実行使用メモリ 91,888 KB
最終ジャッジ日時 2023-09-30 06:02:40
合計ジャッジ時間 7,223 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 65 ms
71,124 KB
testcase_01 AC 65 ms
70,956 KB
testcase_02 AC 64 ms
71,360 KB
testcase_03 AC 64 ms
70,972 KB
testcase_04 AC 66 ms
75,704 KB
testcase_05 AC 65 ms
70,976 KB
testcase_06 AC 63 ms
71,128 KB
testcase_07 AC 67 ms
71,372 KB
testcase_08 AC 63 ms
71,136 KB
testcase_09 WA -
testcase_10 AC 64 ms
71,204 KB
testcase_11 WA -
testcase_12 WA -
testcase_13 AC 97 ms
78,856 KB
testcase_14 AC 129 ms
82,704 KB
testcase_15 AC 195 ms
89,716 KB
testcase_16 AC 192 ms
89,516 KB
testcase_17 AC 132 ms
82,952 KB
testcase_18 AC 108 ms
79,852 KB
testcase_19 AC 178 ms
88,416 KB
testcase_20 AC 65 ms
71,132 KB
testcase_21 AC 147 ms
84,804 KB
testcase_22 AC 175 ms
87,364 KB
testcase_23 AC 89 ms
78,052 KB
testcase_24 AC 84 ms
76,552 KB
testcase_25 AC 144 ms
83,624 KB
testcase_26 AC 193 ms
90,096 KB
testcase_27 AC 181 ms
87,472 KB
testcase_28 AC 229 ms
91,752 KB
testcase_29 AC 162 ms
84,860 KB
testcase_30 AC 153 ms
84,488 KB
testcase_31 AC 210 ms
89,564 KB
testcase_32 AC 165 ms
85,432 KB
testcase_33 AC 301 ms
91,624 KB
testcase_34 AC 305 ms
91,752 KB
testcase_35 AC 280 ms
91,848 KB
testcase_36 AC 291 ms
91,888 KB
testcase_37 AC 288 ms
91,624 KB
testcase_38 AC 279 ms
91,816 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(10):
            dp[0][j%9]+=1
    else:
        dp[0][int(T[0])%9]=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