結果

問題 No.1927 AB-CD
ユーザー kokatsukokatsu
提出日時 2022-05-07 20:28:09
言語 D
(dmd 2.106.1)
結果
TLE  
実行時間 -
コード長 333 bytes
コンパイル時間 3,472 ms
コンパイル使用メモリ 200,368 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-04 17:04:46
合計ジャッジ時間 42,750 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,384 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 2 ms
4,384 KB
testcase_04 TLE -
testcase_05 AC 1,973 ms
4,380 KB
testcase_06 AC 1,922 ms
4,384 KB
testcase_07 AC 1,730 ms
4,380 KB
testcase_08 AC 181 ms
4,384 KB
testcase_09 TLE -
testcase_10 AC 1,587 ms
4,380 KB
testcase_11 AC 1,830 ms
4,380 KB
testcase_12 AC 843 ms
4,380 KB
testcase_13 AC 997 ms
4,380 KB
testcase_14 AC 109 ms
4,380 KB
testcase_15 AC 425 ms
4,380 KB
testcase_16 AC 1,886 ms
4,384 KB
testcase_17 AC 1,393 ms
4,380 KB
testcase_18 AC 1,499 ms
4,384 KB
testcase_19 AC 1,629 ms
4,380 KB
testcase_20 TLE -
testcase_21 AC 1,696 ms
4,380 KB
testcase_22 AC 703 ms
4,380 KB
testcase_23 TLE -
testcase_24 TLE -
testcase_25 TLE -
testcase_26 TLE -
testcase_27 AC 1 ms
4,380 KB
testcase_28 AC 1 ms
4,380 KB
testcase_29 AC 2 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import std;

void main() {
    ulong N;
    readf("%d\n", N);

    auto S = readln.chomp;

    ulong M = 998_244_353;

    ulong cntAB = S.count!(s => (s == 'A' || s == 'B'));

    ulong res = 1;
    foreach (i; 0 .. cntAB) {
        res = (res * (N - i)) % M;
        res = (res * powmod(i+1, M-2, M)) % M;
    }

    res.writeln;
}
0