結果

問題 No.1702 count good string
ユーザー mink1618033mink1618033
提出日時 2021-10-09 00:37:47
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 325 ms / 2,000 ms
コード長 856 bytes
コンパイル時間 515 ms
コンパイル使用メモリ 87,044 KB
実行使用メモリ 133,816 KB
最終ジャッジ日時 2023-09-30 15:20:41
合計ジャッジ時間 10,840 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 71 ms
71,080 KB
testcase_01 AC 71 ms
70,984 KB
testcase_02 AC 80 ms
75,796 KB
testcase_03 AC 79 ms
76,816 KB
testcase_04 AC 78 ms
76,644 KB
testcase_05 AC 77 ms
76,708 KB
testcase_06 AC 78 ms
76,668 KB
testcase_07 AC 78 ms
76,688 KB
testcase_08 AC 78 ms
76,668 KB
testcase_09 AC 82 ms
76,804 KB
testcase_10 AC 80 ms
76,424 KB
testcase_11 AC 85 ms
76,824 KB
testcase_12 AC 78 ms
76,704 KB
testcase_13 AC 299 ms
133,816 KB
testcase_14 AC 291 ms
133,348 KB
testcase_15 AC 288 ms
133,348 KB
testcase_16 AC 304 ms
133,672 KB
testcase_17 AC 292 ms
133,624 KB
testcase_18 AC 291 ms
133,632 KB
testcase_19 AC 322 ms
133,592 KB
testcase_20 AC 293 ms
133,664 KB
testcase_21 AC 325 ms
133,616 KB
testcase_22 AC 286 ms
133,348 KB
testcase_23 AC 92 ms
76,420 KB
testcase_24 AC 88 ms
76,804 KB
testcase_25 AC 88 ms
76,828 KB
testcase_26 AC 88 ms
76,644 KB
testcase_27 AC 89 ms
76,888 KB
testcase_28 AC 89 ms
76,752 KB
testcase_29 AC 89 ms
76,424 KB
testcase_30 AC 87 ms
76,912 KB
testcase_31 AC 89 ms
76,860 KB
testcase_32 AC 89 ms
76,396 KB
testcase_33 AC 278 ms
126,612 KB
testcase_34 AC 270 ms
126,392 KB
testcase_35 AC 279 ms
126,580 KB
testcase_36 AC 267 ms
126,588 KB
testcase_37 AC 270 ms
126,664 KB
testcase_38 AC 279 ms
126,544 KB
testcase_39 AC 277 ms
126,628 KB
testcase_40 AC 269 ms
126,520 KB
testcase_41 AC 282 ms
126,528 KB
testcase_42 AC 276 ms
126,604 KB
testcase_43 AC 282 ms
133,340 KB
testcase_44 AC 294 ms
133,656 KB
testcase_45 AC 72 ms
71,380 KB
testcase_46 AC 73 ms
71,408 KB
testcase_47 AC 72 ms
71,184 KB
testcase_48 AC 71 ms
71,380 KB
testcase_49 AC 72 ms
71,584 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
n = int(input())
if n<9:
    print(0)
    sys.exit()
s = input()
p = 10**9+7
ans = 0
keys = []
key = list("yukicoder")
keys.append({'y': 0, 'u': 1, 'k': 2, 'i': 3, 'c': 4, 'o': 5, 'd': 6, 'e': 7, 'r': 8})
for k in range(9):
    di = {}
    for kk in range(9):
        if k==kk:
            di["?"]=kk
        else:
            di[key[kk]]=kk
    keys.append(di)
    #print(di)

for di in keys:
    dp = [[0]*(n+1) for _ in range(9)]
    for i in range(n):
        if s[i] in di:
            ind = di[s[i]]
        else:
            ind = 9
        for j in range(9):
            if j==ind:
                if j==0:
                    dp[j][i+1]=(dp[j][i]+1)%p
                else:
                    dp[j][i+1]=(dp[j][i]+dp[j-1][i])%p
            else:
                dp[j][i+1]=(dp[j][i])%p
    ans+=dp[8][n]%p
    #print(ans)
print(ans%p)
0