結果

問題 No.1085 桁和の桁和
ユーザー roarisroaris
提出日時 2020-06-21 11:52:59
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 462 ms / 2,000 ms
コード長 703 bytes
コンパイル時間 559 ms
コンパイル使用メモリ 82,560 KB
実行使用メモリ 92,160 KB
最終ジャッジ日時 2024-04-24 10:11:22
合計ジャッジ時間 9,398 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 42 ms
52,096 KB
testcase_01 AC 47 ms
52,480 KB
testcase_02 AC 41 ms
52,224 KB
testcase_03 AC 44 ms
52,608 KB
testcase_04 AC 438 ms
91,264 KB
testcase_05 AC 42 ms
51,968 KB
testcase_06 AC 41 ms
52,224 KB
testcase_07 AC 42 ms
51,712 KB
testcase_08 AC 41 ms
52,480 KB
testcase_09 AC 42 ms
52,096 KB
testcase_10 AC 41 ms
51,968 KB
testcase_11 AC 41 ms
52,352 KB
testcase_12 AC 55 ms
61,952 KB
testcase_13 AC 106 ms
77,952 KB
testcase_14 AC 164 ms
82,432 KB
testcase_15 AC 270 ms
89,728 KB
testcase_16 AC 269 ms
89,600 KB
testcase_17 AC 171 ms
82,304 KB
testcase_18 AC 129 ms
79,232 KB
testcase_19 AC 249 ms
88,448 KB
testcase_20 AC 249 ms
88,448 KB
testcase_21 AC 188 ms
83,584 KB
testcase_22 AC 237 ms
87,040 KB
testcase_23 AC 96 ms
76,928 KB
testcase_24 AC 74 ms
69,376 KB
testcase_25 AC 178 ms
83,072 KB
testcase_26 AC 278 ms
89,856 KB
testcase_27 AC 238 ms
87,680 KB
testcase_28 AC 306 ms
91,776 KB
testcase_29 AC 198 ms
84,480 KB
testcase_30 AC 189 ms
83,712 KB
testcase_31 AC 272 ms
89,728 KB
testcase_32 AC 213 ms
85,248 KB
testcase_33 AC 454 ms
92,032 KB
testcase_34 AC 460 ms
91,904 KB
testcase_35 AC 455 ms
91,776 KB
testcase_36 AC 462 ms
91,904 KB
testcase_37 AC 459 ms
91,776 KB
testcase_38 AC 458 ms
92,160 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline

T = input()[:-1]
N = len(T)
D = int(input())
dp = [[0]*10 for _ in range(N+1)]
dp[0][0] = 1
MOD = 10**9+7

for i in range(N):
    if T[i]!='?':
        for j in range(10):
            k = j+int(T[i])
            
            if k>=10:
                k = int(str(k)[0])+int(str(k)[1])
                
            dp[i+1][k] += dp[i][j]
            dp[i+1][k] %= MOD
    else:
        for j in range(10):
            for k in range(10):
                l = j+k
                
                if l>=10:
                    l = int(str(l)[0])+int(str(l)[1])
                
                dp[i+1][l] += dp[i][j]
                dp[i+1][l] %= MOD

print(dp[N][D])
0