結果

問題 No.1702 count good string
ユーザー V_MelvilleV_Melville
提出日時 2021-10-12 16:07:32
言語 C++17
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 13 ms / 2,000 ms
コード長 682 bytes
コンパイル時間 6,153 ms
コンパイル使用メモリ 263,740 KB
実行使用メモリ 11,624 KB
最終ジャッジ日時 2023-10-17 03:39:59
合計ジャッジ時間 8,065 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 4 ms
11,432 KB
testcase_01 AC 4 ms
11,432 KB
testcase_02 AC 4 ms
11,432 KB
testcase_03 AC 4 ms
11,492 KB
testcase_04 AC 4 ms
11,492 KB
testcase_05 AC 4 ms
11,492 KB
testcase_06 AC 4 ms
11,492 KB
testcase_07 AC 4 ms
11,492 KB
testcase_08 AC 4 ms
11,492 KB
testcase_09 AC 4 ms
11,492 KB
testcase_10 AC 4 ms
11,492 KB
testcase_11 AC 4 ms
11,492 KB
testcase_12 AC 5 ms
11,492 KB
testcase_13 AC 13 ms
11,624 KB
testcase_14 AC 12 ms
11,624 KB
testcase_15 AC 12 ms
11,624 KB
testcase_16 AC 12 ms
11,624 KB
testcase_17 AC 12 ms
11,624 KB
testcase_18 AC 12 ms
11,624 KB
testcase_19 AC 12 ms
11,624 KB
testcase_20 AC 13 ms
11,624 KB
testcase_21 AC 12 ms
11,624 KB
testcase_22 AC 12 ms
11,624 KB
testcase_23 AC 5 ms
11,496 KB
testcase_24 AC 5 ms
11,496 KB
testcase_25 AC 4 ms
11,496 KB
testcase_26 AC 4 ms
11,496 KB
testcase_27 AC 4 ms
11,496 KB
testcase_28 AC 4 ms
11,496 KB
testcase_29 AC 4 ms
11,496 KB
testcase_30 AC 5 ms
11,496 KB
testcase_31 AC 5 ms
11,496 KB
testcase_32 AC 4 ms
11,496 KB
testcase_33 AC 11 ms
11,624 KB
testcase_34 AC 12 ms
11,624 KB
testcase_35 AC 12 ms
11,624 KB
testcase_36 AC 11 ms
11,624 KB
testcase_37 AC 12 ms
11,624 KB
testcase_38 AC 12 ms
11,624 KB
testcase_39 AC 11 ms
11,624 KB
testcase_40 AC 12 ms
11,624 KB
testcase_41 AC 11 ms
11,624 KB
testcase_42 AC 11 ms
11,624 KB
testcase_43 AC 11 ms
11,624 KB
testcase_44 AC 11 ms
11,624 KB
testcase_45 AC 4 ms
11,432 KB
testcase_46 AC 4 ms
11,432 KB
testcase_47 AC 4 ms
11,432 KB
testcase_48 AC 4 ms
11,432 KB
testcase_49 AC 4 ms
11,432 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#if __has_include(<atcoder/all>)
#include <atcoder/all>
using namespace atcoder;
#endif
#define rep(i, n) for (int i = 0; i < (n); ++i)

using std::cin;
using std::cout;
using std::string;
using mint = modint1000000007;

mint dp[100005][10][2];

int main() {
	int n;
	string s;
	cin >> n >> s;
	string t = "yukicoder";
	
	dp[0][0][0] = 1;
	rep(i, n)rep(j, 10)rep(k, 2) {
		dp[i + 1][j][k] += dp[i][j][k];
		if (j < 9 and s[i] == t[j]) {
			dp[i + 1][j + 1][k] += dp[i][j][k];
		}  
		if (j < 9 and s[i] == '?' and k == 0) {
			dp[i + 1][j + 1][k + 1] += dp[i][j][k];
		}
	}
	
	mint ans = dp[n][9][0] + dp[n][9][1];
	cout << ans.val() << '\n';
	
	return 0;
}
0