結果

問題 No.1702 count good string
ユーザー 👑 H20H20
提出日時 2021-10-08 23:08:18
言語 PyPy3
(7.3.13)
結果
AC  
実行時間 294 ms / 2,000 ms
コード長 599 bytes
コンパイル時間 710 ms
コンパイル使用メモリ 87,064 KB
実行使用メモリ 166,028 KB
最終ジャッジ日時 2023-09-30 12:37:44
合計ジャッジ時間 10,880 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 75 ms
70,804 KB
testcase_01 AC 75 ms
71,084 KB
testcase_02 AC 79 ms
71,236 KB
testcase_03 AC 78 ms
71,112 KB
testcase_04 AC 79 ms
70,904 KB
testcase_05 AC 79 ms
71,032 KB
testcase_06 AC 78 ms
71,032 KB
testcase_07 AC 78 ms
71,136 KB
testcase_08 AC 78 ms
71,116 KB
testcase_09 AC 78 ms
71,152 KB
testcase_10 AC 76 ms
70,900 KB
testcase_11 AC 77 ms
71,032 KB
testcase_12 AC 77 ms
71,080 KB
testcase_13 AC 292 ms
165,740 KB
testcase_14 AC 294 ms
165,688 KB
testcase_15 AC 293 ms
165,700 KB
testcase_16 AC 289 ms
166,028 KB
testcase_17 AC 288 ms
165,684 KB
testcase_18 AC 287 ms
165,696 KB
testcase_19 AC 289 ms
165,760 KB
testcase_20 AC 287 ms
165,868 KB
testcase_21 AC 286 ms
165,628 KB
testcase_22 AC 290 ms
165,648 KB
testcase_23 AC 88 ms
76,100 KB
testcase_24 AC 89 ms
76,092 KB
testcase_25 AC 87 ms
76,072 KB
testcase_26 AC 88 ms
76,092 KB
testcase_27 AC 89 ms
76,436 KB
testcase_28 AC 95 ms
76,112 KB
testcase_29 AC 89 ms
76,044 KB
testcase_30 AC 90 ms
76,360 KB
testcase_31 AC 89 ms
76,064 KB
testcase_32 AC 89 ms
76,088 KB
testcase_33 AC 285 ms
165,632 KB
testcase_34 AC 285 ms
165,744 KB
testcase_35 AC 289 ms
165,732 KB
testcase_36 AC 285 ms
165,652 KB
testcase_37 AC 285 ms
165,684 KB
testcase_38 AC 286 ms
165,512 KB
testcase_39 AC 286 ms
165,652 KB
testcase_40 AC 289 ms
165,508 KB
testcase_41 AC 286 ms
165,956 KB
testcase_42 AC 284 ms
165,716 KB
testcase_43 AC 278 ms
165,804 KB
testcase_44 AC 281 ms
165,608 KB
testcase_45 AC 77 ms
71,232 KB
testcase_46 AC 76 ms
71,088 KB
testcase_47 AC 76 ms
71,132 KB
testcase_48 AC 77 ms
70,712 KB
testcase_49 AC 74 ms
71,228 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
S = input()
T = 'yukicoder'
mod = 10**9+7
DP = [[[0] * 2 for _ in range(N+1)] for _ in range(10)]
for i in range(N+1):
    DP[0][i][0]=1

for i in range(9):
    for j in range(N):
        if S[j]==T[i]:
            DP[i+1][j+1][0]=(DP[i+1][j+1][0]+DP[i][j][0])%mod
            DP[i+1][j+1][1]=(DP[i+1][j+1][1]+DP[i][j][1])%mod
        if S[j]=='?':
            DP[i+1][j+1][1]=(DP[i+1][j+1][1]+DP[i][j][0])%mod

    for j in range(N):
        DP[i+1][j+1][0]=(DP[i+1][j+1][0]+DP[i+1][j][0])%mod
        DP[i+1][j+1][1]=(DP[i+1][j+1][1]+DP[i+1][j][1])%mod

print(sum(DP[-1][-1])%mod)
0