結果

問題 No.1702 count good string
ユーザー brthyyjpbrthyyjp
提出日時 2021-10-09 17:37:50
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 131 ms / 2,000 ms
コード長 562 bytes
コンパイル時間 271 ms
コンパイル使用メモリ 87,224 KB
実行使用メモリ 77,900 KB
最終ジャッジ日時 2023-10-11 04:16:50
合計ジャッジ時間 7,086 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 73 ms
71,256 KB
testcase_01 AC 73 ms
71,336 KB
testcase_02 AC 74 ms
71,472 KB
testcase_03 AC 73 ms
71,368 KB
testcase_04 AC 74 ms
71,528 KB
testcase_05 AC 74 ms
71,448 KB
testcase_06 AC 75 ms
71,472 KB
testcase_07 AC 76 ms
71,328 KB
testcase_08 AC 74 ms
71,420 KB
testcase_09 AC 74 ms
71,424 KB
testcase_10 AC 74 ms
71,276 KB
testcase_11 AC 74 ms
71,368 KB
testcase_12 AC 74 ms
71,260 KB
testcase_13 AC 126 ms
77,468 KB
testcase_14 AC 125 ms
77,644 KB
testcase_15 AC 128 ms
77,736 KB
testcase_16 AC 122 ms
77,676 KB
testcase_17 AC 125 ms
77,596 KB
testcase_18 AC 131 ms
77,900 KB
testcase_19 AC 129 ms
77,688 KB
testcase_20 AC 125 ms
77,532 KB
testcase_21 AC 128 ms
77,736 KB
testcase_22 AC 129 ms
77,688 KB
testcase_23 AC 74 ms
71,592 KB
testcase_24 AC 73 ms
71,260 KB
testcase_25 AC 74 ms
71,256 KB
testcase_26 AC 75 ms
71,164 KB
testcase_27 AC 73 ms
71,372 KB
testcase_28 AC 74 ms
71,372 KB
testcase_29 AC 74 ms
71,452 KB
testcase_30 AC 73 ms
71,288 KB
testcase_31 AC 74 ms
71,520 KB
testcase_32 AC 73 ms
71,252 KB
testcase_33 AC 115 ms
77,724 KB
testcase_34 AC 113 ms
77,784 KB
testcase_35 AC 116 ms
77,456 KB
testcase_36 AC 114 ms
77,348 KB
testcase_37 AC 116 ms
77,804 KB
testcase_38 AC 116 ms
77,440 KB
testcase_39 AC 120 ms
77,500 KB
testcase_40 AC 115 ms
77,364 KB
testcase_41 AC 114 ms
77,456 KB
testcase_42 AC 114 ms
77,732 KB
testcase_43 AC 101 ms
77,092 KB
testcase_44 AC 122 ms
77,568 KB
testcase_45 AC 72 ms
71,224 KB
testcase_46 AC 71 ms
71,416 KB
testcase_47 AC 75 ms
71,388 KB
testcase_48 AC 74 ms
71,092 KB
testcase_49 AC 75 ms
71,156 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
s = str(input())

d = {'y':0, 'u':1, 'k':2, 'i':3, 'c':4, 'o':5, 'd':6, 'e':7, 'r':8}
mod = 10**9+7

dp = [[0, 0] for i in range(9)]
for c in s:
    if c in d:
        j = d[c]
        if j == 0:
            dp[0][0] += 1
        else:
            dp[j][0] += dp[j-1][0]
            dp[j][0] += mod
            dp[j][1] += dp[j-1][1]
            dp[j][1] += mod
    elif c == '?':
        dp[0][1] += 1
        for j in reversed(range(1, 9)):
            dp[j][1] += dp[j-1][0]
            dp[j][1] += mod
ans = dp[8][0]+dp[8][1]
print(ans%mod)
0