結果

問題 No.1702 count good string
ユーザー gr1msl3ygr1msl3y
提出日時 2021-10-08 22:21:21
言語 PyPy3
(7.3.13)
結果
AC  
実行時間 104 ms / 2,000 ms
コード長 437 bytes
コンパイル時間 302 ms
コンパイル使用メモリ 86,252 KB
実行使用メモリ 76,276 KB
最終ジャッジ日時 2023-09-30 10:45:52
合計ジャッジ時間 5,937 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 70 ms
70,868 KB
testcase_01 AC 68 ms
70,948 KB
testcase_02 AC 69 ms
70,652 KB
testcase_03 AC 68 ms
70,904 KB
testcase_04 AC 76 ms
70,864 KB
testcase_05 AC 69 ms
70,892 KB
testcase_06 AC 69 ms
70,832 KB
testcase_07 AC 69 ms
70,568 KB
testcase_08 AC 70 ms
70,604 KB
testcase_09 AC 70 ms
70,656 KB
testcase_10 AC 69 ms
70,960 KB
testcase_11 AC 71 ms
70,860 KB
testcase_12 AC 70 ms
70,748 KB
testcase_13 AC 104 ms
76,244 KB
testcase_14 AC 89 ms
76,244 KB
testcase_15 AC 89 ms
76,276 KB
testcase_16 AC 88 ms
76,244 KB
testcase_17 AC 88 ms
76,108 KB
testcase_18 AC 85 ms
76,036 KB
testcase_19 AC 89 ms
75,980 KB
testcase_20 AC 85 ms
76,076 KB
testcase_21 AC 86 ms
76,108 KB
testcase_22 AC 89 ms
76,000 KB
testcase_23 AC 73 ms
70,656 KB
testcase_24 AC 70 ms
70,864 KB
testcase_25 AC 71 ms
70,748 KB
testcase_26 AC 72 ms
70,600 KB
testcase_27 AC 70 ms
70,756 KB
testcase_28 AC 66 ms
70,956 KB
testcase_29 AC 67 ms
70,460 KB
testcase_30 AC 68 ms
70,676 KB
testcase_31 AC 68 ms
70,876 KB
testcase_32 AC 70 ms
70,996 KB
testcase_33 AC 87 ms
76,004 KB
testcase_34 AC 85 ms
75,764 KB
testcase_35 AC 85 ms
75,976 KB
testcase_36 AC 85 ms
75,888 KB
testcase_37 AC 85 ms
76,032 KB
testcase_38 AC 84 ms
75,792 KB
testcase_39 AC 83 ms
76,036 KB
testcase_40 AC 87 ms
75,956 KB
testcase_41 AC 86 ms
76,256 KB
testcase_42 AC 87 ms
76,060 KB
testcase_43 AC 79 ms
75,568 KB
testcase_44 AC 91 ms
75,804 KB
testcase_45 AC 69 ms
70,816 KB
testcase_46 AC 68 ms
70,944 KB
testcase_47 AC 70 ms
70,964 KB
testcase_48 AC 69 ms
70,808 KB
testcase_49 AC 67 ms
70,456 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
S = input()
MOD = 10**9+7
T = 'yukicoder'
U = set(list(T))
dp = [[0]*3 for _ in range(10)]
dp[0][0] = 1

for s in S:
    if s == '?':
        for i in range(9, 0, -1):
            dp[i][1] += dp[i-1][0]
            dp[i][1] %= MOD
    elif s in U:
        i = T.index(s)
        dp[i+1][0] += dp[i][0]
        dp[i+1][0] %= MOD
        dp[i+1][2] += dp[i][1]+dp[i][2]
        dp[i+1][2] %= MOD

print(sum(dp[-1]) % MOD)
0