結果

問題 No.1702 count good string
ユーザー nebukuro09nebukuro09
提出日時 2021-10-08 22:12:39
言語 D
(dmd 2.107.1)
結果
AC  
実行時間 180 ms / 2,000 ms
コード長 766 bytes
コンパイル時間 792 ms
コンパイル使用メモリ 100,384 KB
実行使用メモリ 58,444 KB
最終ジャッジ日時 2023-09-04 14:23:13
合計ジャッジ時間 7,531 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 1 ms
4,384 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 2 ms
4,384 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 AC 1 ms
4,380 KB
testcase_06 AC 1 ms
4,380 KB
testcase_07 AC 2 ms
4,384 KB
testcase_08 AC 1 ms
4,380 KB
testcase_09 AC 1 ms
4,380 KB
testcase_10 AC 2 ms
4,384 KB
testcase_11 AC 2 ms
4,384 KB
testcase_12 AC 2 ms
4,384 KB
testcase_13 AC 175 ms
54,872 KB
testcase_14 AC 176 ms
56,996 KB
testcase_15 AC 175 ms
56,160 KB
testcase_16 AC 175 ms
54,980 KB
testcase_17 AC 174 ms
55,540 KB
testcase_18 AC 174 ms
55,304 KB
testcase_19 AC 175 ms
54,904 KB
testcase_20 AC 175 ms
54,896 KB
testcase_21 AC 173 ms
55,984 KB
testcase_22 AC 174 ms
55,528 KB
testcase_23 AC 3 ms
4,384 KB
testcase_24 AC 3 ms
4,380 KB
testcase_25 AC 3 ms
4,380 KB
testcase_26 AC 3 ms
4,380 KB
testcase_27 AC 3 ms
4,380 KB
testcase_28 AC 3 ms
4,380 KB
testcase_29 AC 3 ms
4,384 KB
testcase_30 AC 3 ms
4,384 KB
testcase_31 AC 3 ms
4,388 KB
testcase_32 AC 3 ms
4,384 KB
testcase_33 AC 174 ms
54,840 KB
testcase_34 AC 174 ms
54,920 KB
testcase_35 AC 175 ms
55,824 KB
testcase_36 AC 173 ms
58,444 KB
testcase_37 AC 172 ms
54,856 KB
testcase_38 AC 171 ms
55,308 KB
testcase_39 AC 172 ms
54,832 KB
testcase_40 AC 173 ms
54,828 KB
testcase_41 AC 174 ms
55,732 KB
testcase_42 AC 175 ms
54,904 KB
testcase_43 AC 172 ms
55,524 KB
testcase_44 AC 180 ms
54,944 KB
testcase_45 AC 1 ms
4,384 KB
testcase_46 AC 1 ms
4,384 KB
testcase_47 AC 2 ms
4,384 KB
testcase_48 AC 1 ms
4,384 KB
testcase_49 AC 2 ms
4,384 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import std.stdio, std.array, std.string, std.conv, std.algorithm;
import std.typecons, std.range, std.random, std.math, std.container;
import std.numeric, std.bigint, core.bitop;

immutable long MOD = 10^^9 + 7;

void main() {
    auto N = readln.chomp.to!int;
    auto S = readln.chomp;
    auto yukicoder = "yukicoder";

    auto dp = new long[][][](N+1, 10, 2);
    dp[0][0][0] = 1;

    foreach (i; 0..N) foreach (j; 0..10) foreach (k; 0..2) {
        (dp[i+1][j][k] += dp[i][j][k]) %= MOD;
        if (j == 9) continue;
        if (k == 0 && S[i] == '?') {
            (dp[i+1][j+1][1] += dp[i][j][k]) %= MOD;
        }
        if (S[i] == yukicoder[j]) {
            (dp[i+1][j+1][k] += dp[i][j][k]) %= MOD;
        }
    }

    writeln(dp[N][9].sum % MOD);
}
0