結果

問題 No.1927 AB-CD
ユーザー hir355hir355
提出日時 2022-05-06 21:25:50
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 82 ms / 2,000 ms
コード長 271 bytes
コンパイル時間 997 ms
コンパイル使用メモリ 86,988 KB
実行使用メモリ 79,100 KB
最終ジャッジ日時 2023-09-20 02:13:08
合計ジャッジ時間 4,714 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 79 ms
78,440 KB
testcase_01 AC 80 ms
78,284 KB
testcase_02 AC 78 ms
78,136 KB
testcase_03 AC 77 ms
78,280 KB
testcase_04 AC 79 ms
78,660 KB
testcase_05 AC 77 ms
78,724 KB
testcase_06 AC 80 ms
78,612 KB
testcase_07 AC 80 ms
78,588 KB
testcase_08 AC 78 ms
78,572 KB
testcase_09 AC 82 ms
78,724 KB
testcase_10 AC 79 ms
78,724 KB
testcase_11 AC 79 ms
78,588 KB
testcase_12 AC 79 ms
78,280 KB
testcase_13 AC 79 ms
78,116 KB
testcase_14 AC 77 ms
78,212 KB
testcase_15 AC 78 ms
78,272 KB
testcase_16 AC 79 ms
78,676 KB
testcase_17 AC 79 ms
78,584 KB
testcase_18 AC 78 ms
78,624 KB
testcase_19 AC 79 ms
78,456 KB
testcase_20 AC 79 ms
78,944 KB
testcase_21 AC 78 ms
78,464 KB
testcase_22 AC 77 ms
78,364 KB
testcase_23 AC 80 ms
79,068 KB
testcase_24 AC 79 ms
79,100 KB
testcase_25 AC 80 ms
78,984 KB
testcase_26 AC 81 ms
78,988 KB
testcase_27 AC 78 ms
78,472 KB
testcase_28 AC 79 ms
78,276 KB
testcase_29 AC 81 ms
78,272 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

MOD = 998244353
fac = [1] * (3 * 10 ** 5 + 1)
for i in range(len(fac) - 1):
    fac[i + 1] = fac[i] * (i + 1) % MOD

def comb(n, k):
    return fac[n] * pow(fac[n - k] * fac[k], MOD - 2, MOD) % MOD

n = int(input())
s = input()
print(comb(n, s.count('C') + s.count('D')))
0