結果

問題 No.1702 count good string
ユーザー 👑 SPD_9X2SPD_9X2
提出日時 2021-10-08 22:15:54
言語 PyPy3
(7.3.13)
結果
AC  
実行時間 256 ms / 2,000 ms
コード長 645 bytes
コンパイル時間 302 ms
コンパイル使用メモリ 86,728 KB
実行使用メモリ 77,444 KB
最終ジャッジ日時 2023-09-30 10:37:49
合計ジャッジ時間 9,736 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 70 ms
71,360 KB
testcase_01 AC 71 ms
71,124 KB
testcase_02 AC 71 ms
71,244 KB
testcase_03 AC 80 ms
76,140 KB
testcase_04 AC 78 ms
76,220 KB
testcase_05 AC 78 ms
76,188 KB
testcase_06 AC 78 ms
76,248 KB
testcase_07 AC 78 ms
76,176 KB
testcase_08 AC 80 ms
76,128 KB
testcase_09 AC 78 ms
76,164 KB
testcase_10 AC 79 ms
76,160 KB
testcase_11 AC 78 ms
76,292 KB
testcase_12 AC 81 ms
76,464 KB
testcase_13 AC 256 ms
77,424 KB
testcase_14 AC 254 ms
77,332 KB
testcase_15 AC 250 ms
77,216 KB
testcase_16 AC 255 ms
77,144 KB
testcase_17 AC 252 ms
77,424 KB
testcase_18 AC 236 ms
77,288 KB
testcase_19 AC 250 ms
77,120 KB
testcase_20 AC 255 ms
77,236 KB
testcase_21 AC 247 ms
77,272 KB
testcase_22 AC 248 ms
77,284 KB
testcase_23 AC 90 ms
77,060 KB
testcase_24 AC 91 ms
77,224 KB
testcase_25 AC 92 ms
77,232 KB
testcase_26 AC 91 ms
77,124 KB
testcase_27 AC 93 ms
77,192 KB
testcase_28 AC 90 ms
77,020 KB
testcase_29 AC 91 ms
77,060 KB
testcase_30 AC 92 ms
77,148 KB
testcase_31 AC 96 ms
77,360 KB
testcase_32 AC 94 ms
77,320 KB
testcase_33 AC 245 ms
77,344 KB
testcase_34 AC 244 ms
77,236 KB
testcase_35 AC 248 ms
77,264 KB
testcase_36 AC 233 ms
77,152 KB
testcase_37 AC 234 ms
77,304 KB
testcase_38 AC 234 ms
77,284 KB
testcase_39 AC 246 ms
77,268 KB
testcase_40 AC 249 ms
77,248 KB
testcase_41 AC 248 ms
77,288 KB
testcase_42 AC 242 ms
77,444 KB
testcase_43 AC 246 ms
77,092 KB
testcase_44 AC 248 ms
77,324 KB
testcase_45 AC 72 ms
70,968 KB
testcase_46 AC 70 ms
71,268 KB
testcase_47 AC 69 ms
71,104 KB
testcase_48 AC 70 ms
71,108 KB
testcase_49 AC 71 ms
71,268 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

"""

"""
from sys import stdin
import sys

yuki = "yukicoder"

N = int(stdin.readline())

S = stdin.readline()[:-1]

dp = [ [0] * 2 for i in range(len(yuki)+1)]
dp[0][0] = 1

mod = 10**9+7

for i in range(N):

    ndp = [ [dp[a][j] for j in range(2)]  for a in range(len(yuki)+1)]

    for a in range(len(yuki)):
        for b in range(2):

            if yuki[a] == S[i]:
                ndp[a+1][b] += dp[a][b]
                ndp[a+1][b] %= mod
            elif b == 0 and S[i] == "?":
                ndp[a+1][1] += dp[a][0]
                ndp[a+1][1] %= mod

    dp = ndp

ans = 0
for i in range(2):
    ans += dp[-1][i]
print (ans % mod)
0