結果

問題 No.1702 count good string
ユーザー tnodinotnodino
提出日時 2022-05-25 18:20:26
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 150 ms / 2,000 ms
コード長 558 bytes
コンパイル時間 178 ms
コンパイル使用メモリ 81,744 KB
実行使用メモリ 106,528 KB
最終ジャッジ日時 2023-10-20 19:13:18
合計ジャッジ時間 5,957 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 39 ms
53,448 KB
testcase_01 AC 38 ms
53,448 KB
testcase_02 AC 39 ms
53,448 KB
testcase_03 AC 39 ms
53,448 KB
testcase_04 AC 40 ms
53,448 KB
testcase_05 AC 40 ms
53,448 KB
testcase_06 AC 40 ms
53,448 KB
testcase_07 AC 40 ms
53,448 KB
testcase_08 AC 40 ms
53,448 KB
testcase_09 AC 40 ms
53,448 KB
testcase_10 AC 40 ms
53,448 KB
testcase_11 AC 40 ms
53,448 KB
testcase_12 AC 40 ms
53,448 KB
testcase_13 AC 145 ms
106,508 KB
testcase_14 AC 145 ms
106,504 KB
testcase_15 AC 144 ms
106,508 KB
testcase_16 AC 145 ms
106,508 KB
testcase_17 AC 145 ms
106,504 KB
testcase_18 AC 146 ms
106,504 KB
testcase_19 AC 146 ms
106,504 KB
testcase_20 AC 144 ms
106,508 KB
testcase_21 AC 144 ms
106,504 KB
testcase_22 AC 142 ms
106,508 KB
testcase_23 AC 52 ms
64,268 KB
testcase_24 AC 52 ms
64,268 KB
testcase_25 AC 53 ms
64,268 KB
testcase_26 AC 52 ms
64,268 KB
testcase_27 AC 54 ms
64,292 KB
testcase_28 AC 52 ms
64,268 KB
testcase_29 AC 52 ms
64,268 KB
testcase_30 AC 53 ms
64,268 KB
testcase_31 AC 52 ms
64,268 KB
testcase_32 AC 55 ms
64,292 KB
testcase_33 AC 143 ms
106,504 KB
testcase_34 AC 143 ms
106,508 KB
testcase_35 AC 149 ms
106,512 KB
testcase_36 AC 143 ms
106,504 KB
testcase_37 AC 143 ms
106,508 KB
testcase_38 AC 145 ms
106,528 KB
testcase_39 AC 143 ms
106,504 KB
testcase_40 AC 143 ms
106,504 KB
testcase_41 AC 146 ms
106,528 KB
testcase_42 AC 150 ms
106,512 KB
testcase_43 AC 138 ms
106,468 KB
testcase_44 AC 143 ms
106,500 KB
testcase_45 AC 39 ms
53,448 KB
testcase_46 AC 38 ms
53,448 KB
testcase_47 AC 38 ms
53,448 KB
testcase_48 AC 39 ms
53,448 KB
testcase_49 AC 38 ms
53,448 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

mod = 10**9+7
N = int(input())
S = input()
T = 'yukicoder'
DP1 = [[0] * 10 for _ in range(N+1)]
DP2 = [[0] * 10 for _ in range(N+1)]
DP1[0][0] = 1
for i in range(N):
    for j in range(9):
        if S[i] == T[j]:
            DP1[i+1][j+1] += DP1[i][j]
            DP2[i+1][j+1] += DP2[i][j]
    if S[i] == '?':
        for j in range(9):
            DP2[i+1][j+1] += DP1[i][j]
    for j in range(10):
        DP1[i+1][j] += DP1[i][j]
        DP2[i+1][j] += DP2[i][j]
        DP1[i+1][j] %= mod
        DP2[i+1][j] %= mod
print((DP1[N][9] + DP2[N][9]) % mod)
0