結果

問題 No.1702 count good string
ユーザー tassei903tassei903
提出日時 2021-10-08 22:32:21
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 824 ms / 2,000 ms
コード長 980 bytes
コンパイル時間 332 ms
コンパイル使用メモリ 86,316 KB
実行使用メモリ 229,772 KB
最終ジャッジ日時 2023-09-30 11:25:15
合計ジャッジ時間 21,024 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 79 ms
70,712 KB
testcase_01 AC 76 ms
71,056 KB
testcase_02 AC 83 ms
76,116 KB
testcase_03 AC 93 ms
76,264 KB
testcase_04 AC 91 ms
76,372 KB
testcase_05 AC 90 ms
75,992 KB
testcase_06 AC 90 ms
76,268 KB
testcase_07 AC 90 ms
76,560 KB
testcase_08 AC 91 ms
76,272 KB
testcase_09 AC 93 ms
76,100 KB
testcase_10 AC 92 ms
76,168 KB
testcase_11 AC 100 ms
76,440 KB
testcase_12 AC 90 ms
76,272 KB
testcase_13 AC 735 ms
229,288 KB
testcase_14 AC 736 ms
229,696 KB
testcase_15 AC 740 ms
229,360 KB
testcase_16 AC 743 ms
229,480 KB
testcase_17 AC 739 ms
229,480 KB
testcase_18 AC 725 ms
229,464 KB
testcase_19 AC 732 ms
229,644 KB
testcase_20 AC 743 ms
229,644 KB
testcase_21 AC 824 ms
229,584 KB
testcase_22 AC 729 ms
229,460 KB
testcase_23 AC 109 ms
77,300 KB
testcase_24 AC 110 ms
77,428 KB
testcase_25 AC 110 ms
77,124 KB
testcase_26 AC 110 ms
77,536 KB
testcase_27 AC 108 ms
77,212 KB
testcase_28 AC 109 ms
77,496 KB
testcase_29 AC 110 ms
77,484 KB
testcase_30 AC 111 ms
77,372 KB
testcase_31 AC 112 ms
77,640 KB
testcase_32 AC 112 ms
77,400 KB
testcase_33 AC 722 ms
229,768 KB
testcase_34 AC 710 ms
229,240 KB
testcase_35 AC 711 ms
229,524 KB
testcase_36 AC 699 ms
229,420 KB
testcase_37 AC 709 ms
229,772 KB
testcase_38 AC 701 ms
229,584 KB
testcase_39 AC 719 ms
229,112 KB
testcase_40 AC 719 ms
229,768 KB
testcase_41 AC 725 ms
229,584 KB
testcase_42 AC 725 ms
229,448 KB
testcase_43 AC 730 ms
229,656 KB
testcase_44 AC 733 ms
229,580 KB
testcase_45 AC 80 ms
74,708 KB
testcase_46 AC 80 ms
74,616 KB
testcase_47 AC 79 ms
74,536 KB
testcase_48 AC 81 ms
74,616 KB
testcase_49 AC 78 ms
71,140 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = lambda :sys.stdin.readline()[:-1]
ni = lambda :int(input())
na = lambda :list(map(int,input().split()))
sys.setrecursionlimit(10**7)
yes = lambda :print("yes");Yes = lambda :print("Yes");YES = lambda : print("YES")
no = lambda :print("no");No = lambda :print("No");NO = lambda : print("NO")
#######################################################################
N = ni()
S = list(input())
s = "yukicoder"
s = list(s)
p = [s]
for i in range(9):
    z = s.copy()
    z[i] = "?"
    p.append(z)
    

ans= 0
mod = 10**9+7
for _ in range(10):
    z = p[_]
    dp = [[0 for i in range(len(z)+1)] for i in range(N+1)]
    dp[0][0]=1

    for i in range(N):
        for j in range(len(z)+1):
            dp[i+1][j]+=dp[i][j]
            dp[i+1][j]%=mod
        for j in range(len(z)):
            if S[i]==z[j]:
                dp[i+1][j+1]+=dp[i][j]
                dp[i+1][j+1]%=mod
    ans += dp[-1][-1]
    ans %= mod
    #print(z)
    #print(dp,"\n")
print(ans)
0