結果

問題 No.1702 count good string
ユーザー NatsubiSoganNatsubiSogan
提出日時 2021-10-08 22:27:56
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 720 ms / 2,000 ms
コード長 614 bytes
コンパイル時間 280 ms
コンパイル使用メモリ 86,836 KB
実行使用メモリ 228,248 KB
最終ジャッジ日時 2023-09-30 11:01:17
合計ジャッジ時間 19,518 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 74 ms
71,148 KB
testcase_01 AC 75 ms
71,192 KB
testcase_02 AC 81 ms
76,432 KB
testcase_03 AC 83 ms
76,496 KB
testcase_04 AC 88 ms
76,428 KB
testcase_05 AC 86 ms
76,068 KB
testcase_06 AC 84 ms
76,508 KB
testcase_07 AC 84 ms
76,332 KB
testcase_08 AC 85 ms
76,408 KB
testcase_09 AC 86 ms
76,196 KB
testcase_10 AC 86 ms
75,972 KB
testcase_11 AC 90 ms
76,216 KB
testcase_12 AC 85 ms
76,268 KB
testcase_13 AC 647 ms
227,952 KB
testcase_14 AC 654 ms
227,988 KB
testcase_15 AC 659 ms
228,208 KB
testcase_16 AC 692 ms
228,204 KB
testcase_17 AC 652 ms
228,048 KB
testcase_18 AC 656 ms
228,036 KB
testcase_19 AC 647 ms
227,940 KB
testcase_20 AC 652 ms
228,064 KB
testcase_21 AC 646 ms
227,696 KB
testcase_22 AC 655 ms
227,828 KB
testcase_23 AC 101 ms
76,564 KB
testcase_24 AC 99 ms
76,688 KB
testcase_25 AC 99 ms
76,544 KB
testcase_26 AC 100 ms
76,540 KB
testcase_27 AC 99 ms
76,396 KB
testcase_28 AC 99 ms
76,380 KB
testcase_29 AC 97 ms
76,272 KB
testcase_30 AC 99 ms
76,544 KB
testcase_31 AC 98 ms
76,444 KB
testcase_32 AC 98 ms
76,172 KB
testcase_33 AC 687 ms
228,176 KB
testcase_34 AC 687 ms
228,048 KB
testcase_35 AC 720 ms
228,040 KB
testcase_36 AC 686 ms
228,248 KB
testcase_37 AC 684 ms
227,832 KB
testcase_38 AC 688 ms
228,244 KB
testcase_39 AC 691 ms
227,880 KB
testcase_40 AC 687 ms
228,048 KB
testcase_41 AC 690 ms
227,960 KB
testcase_42 AC 718 ms
228,036 KB
testcase_43 AC 632 ms
227,988 KB
testcase_44 AC 629 ms
228,124 KB
testcase_45 AC 74 ms
71,144 KB
testcase_46 AC 74 ms
71,224 KB
testcase_47 AC 74 ms
70,768 KB
testcase_48 AC 73 ms
71,108 KB
testcase_49 AC 74 ms
70,788 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

ans = 0
n = int(input())
s = input()
ans = 0
def main(s, t):
	global ans
	n = len(s)
	t = list(t)
	dp = [[0] * (len(t) + 1) for i in range(n + 1)]
	dp[0][0] = 1
	mod = 10 ** 9 + 7
	for i in range(n):
		try:
			ind = t.index(s[i])
		except: ind = len(t) + 1
		for j in range(len(t) + 1):
			dp[i + 1][j] += dp[i][j]
			if j == ind: dp[i + 1][j + 1] += dp[i][j]; dp[i + 1][j + 1] %= mod
			dp[i + 1][j] %= mod
	ans += dp[-1][-1]
ts = ["yukicoder", "?ukicoder", "y?kicoder", "yu?icoder", "yuk?coder", "yuki?oder", "yukic?der", "yukico?er", "yukicod?r", "yukicode?"]
for t in ts:
	main(s, t)
print(ans % (10 ** 9 + 7))
0