結果

問題 No.1702 count good string
ユーザー kohei2019kohei2019
提出日時 2023-06-04 18:02:04
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 97 ms / 2,000 ms
コード長 606 bytes
コンパイル時間 327 ms
コンパイル使用メモリ 86,992 KB
実行使用メモリ 77,360 KB
最終ジャッジ日時 2023-08-28 08:18:16
合計ジャッジ時間 6,250 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 69 ms
71,220 KB
testcase_01 AC 68 ms
71,224 KB
testcase_02 AC 68 ms
71,372 KB
testcase_03 AC 70 ms
71,124 KB
testcase_04 AC 70 ms
71,120 KB
testcase_05 AC 71 ms
71,176 KB
testcase_06 AC 69 ms
71,172 KB
testcase_07 AC 67 ms
71,184 KB
testcase_08 AC 69 ms
71,120 KB
testcase_09 AC 67 ms
71,028 KB
testcase_10 AC 68 ms
71,184 KB
testcase_11 AC 68 ms
71,340 KB
testcase_12 AC 69 ms
71,212 KB
testcase_13 AC 97 ms
77,360 KB
testcase_14 AC 96 ms
77,068 KB
testcase_15 AC 94 ms
77,160 KB
testcase_16 AC 96 ms
77,028 KB
testcase_17 AC 94 ms
77,128 KB
testcase_18 AC 94 ms
76,988 KB
testcase_19 AC 97 ms
77,148 KB
testcase_20 AC 95 ms
77,232 KB
testcase_21 AC 93 ms
77,160 KB
testcase_22 AC 96 ms
77,032 KB
testcase_23 AC 77 ms
76,772 KB
testcase_24 AC 78 ms
76,692 KB
testcase_25 AC 75 ms
76,296 KB
testcase_26 AC 76 ms
76,364 KB
testcase_27 AC 78 ms
76,576 KB
testcase_28 AC 77 ms
76,376 KB
testcase_29 AC 77 ms
76,364 KB
testcase_30 AC 76 ms
76,364 KB
testcase_31 AC 75 ms
76,472 KB
testcase_32 AC 77 ms
76,472 KB
testcase_33 AC 93 ms
77,004 KB
testcase_34 AC 95 ms
77,244 KB
testcase_35 AC 93 ms
77,300 KB
testcase_36 AC 94 ms
77,028 KB
testcase_37 AC 93 ms
77,196 KB
testcase_38 AC 92 ms
77,076 KB
testcase_39 AC 93 ms
77,200 KB
testcase_40 AC 94 ms
76,948 KB
testcase_41 AC 92 ms
77,076 KB
testcase_42 AC 94 ms
77,312 KB
testcase_43 AC 86 ms
77,084 KB
testcase_44 AC 91 ms
77,132 KB
testcase_45 AC 69 ms
71,412 KB
testcase_46 AC 70 ms
71,212 KB
testcase_47 AC 69 ms
71,180 KB
testcase_48 AC 68 ms
71,264 KB
testcase_49 AC 70 ms
71,120 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
S = input()
mod = 10**9+7
# i文字目まで見てyukicoderのj文字目まできて?をk個
yuki = 'yukicoder'
dp = [[0]*(len(yuki)+1) for i in range(2)]
dp[0][0] = 1
for i in range(N):
    if S[i] != "?":
        for j in range(1,len(yuki)+1):
            if S[i] == yuki[j-1]:
                dp[0][j] += dp[0][j-1]
                dp[0][j] %= mod
                dp[1][j] += dp[1][j-1]
                dp[1][j] %= mod
            
    if S[i] == "?":
        for j in range(1,len(yuki)+1):
            dp[1][j] += dp[0][j-1]
            dp[1][j] %= mod
print((dp[0][-1]+dp[1][-1])%mod)
0