結果

問題 No.1927 AB-CD
ユーザー zutsuzutsu
提出日時 2022-05-08 11:08:20
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 907 ms / 2,000 ms
コード長 281 bytes
コンパイル時間 103 ms
コンパイル使用メモリ 10,680 KB
実行使用メモリ 10,500 KB
最終ジャッジ日時 2023-09-22 05:39:22
合計ジャッジ時間 12,315 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
7,836 KB
testcase_01 AC 17 ms
7,900 KB
testcase_02 AC 18 ms
8,052 KB
testcase_03 AC 17 ms
8,060 KB
testcase_04 AC 609 ms
9,816 KB
testcase_05 AC 550 ms
9,712 KB
testcase_06 AC 531 ms
9,500 KB
testcase_07 AC 451 ms
9,276 KB
testcase_08 AC 32 ms
8,244 KB
testcase_09 AC 631 ms
9,912 KB
testcase_10 AC 400 ms
9,340 KB
testcase_11 AC 496 ms
9,592 KB
testcase_12 AC 160 ms
8,984 KB
testcase_13 AC 201 ms
8,948 KB
testcase_14 AC 25 ms
7,988 KB
testcase_15 AC 68 ms
8,524 KB
testcase_16 AC 520 ms
9,572 KB
testcase_17 AC 325 ms
9,200 KB
testcase_18 AC 364 ms
9,420 KB
testcase_19 AC 413 ms
9,560 KB
testcase_20 AC 730 ms
9,880 KB
testcase_21 AC 441 ms
9,444 KB
testcase_22 AC 125 ms
8,836 KB
testcase_23 AC 796 ms
10,088 KB
testcase_24 AC 905 ms
10,500 KB
testcase_25 AC 907 ms
10,212 KB
testcase_26 AC 899 ms
10,312 KB
testcase_27 AC 17 ms
7,944 KB
testcase_28 AC 18 ms
7,888 KB
testcase_29 AC 17 ms
8,052 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import math

N = int(input())
S = input()
mod = 998244353

ab = 0
for s in S:
    if s == 'A' or s == 'B':
        ab += 1

def modinv(x):
    return pow(math.factorial(x),mod-2,mod)

ans = modinv(ab) * modinv(N-ab)
for i in range(N):
    ans *= i+1
    ans %= mod
    
print(ans)
0