結果

問題 No.1927 AB-CD
ユーザー first_vilfirst_vil
提出日時 2022-05-06 22:49:25
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 89 ms / 2,000 ms
コード長 186 bytes
コンパイル時間 505 ms
コンパイル使用メモリ 10,468 KB
実行使用メモリ 8,824 KB
最終ジャッジ日時 2023-09-20 03:57:15
合計ジャッジ時間 2,881 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 17 ms
7,756 KB
testcase_01 AC 17 ms
7,816 KB
testcase_02 AC 16 ms
7,724 KB
testcase_03 AC 16 ms
7,760 KB
testcase_04 AC 71 ms
8,560 KB
testcase_05 AC 64 ms
8,480 KB
testcase_06 AC 68 ms
8,548 KB
testcase_07 AC 63 ms
8,384 KB
testcase_08 AC 21 ms
7,780 KB
testcase_09 AC 73 ms
8,584 KB
testcase_10 AC 57 ms
8,496 KB
testcase_11 AC 63 ms
8,500 KB
testcase_12 AC 38 ms
8,280 KB
testcase_13 AC 43 ms
8,272 KB
testcase_14 AC 19 ms
7,844 KB
testcase_15 AC 26 ms
8,180 KB
testcase_16 AC 65 ms
8,504 KB
testcase_17 AC 54 ms
8,380 KB
testcase_18 AC 54 ms
8,492 KB
testcase_19 AC 56 ms
8,460 KB
testcase_20 AC 73 ms
8,524 KB
testcase_21 AC 58 ms
8,464 KB
testcase_22 AC 35 ms
8,172 KB
testcase_23 AC 83 ms
8,616 KB
testcase_24 AC 85 ms
8,824 KB
testcase_25 AC 89 ms
8,732 KB
testcase_26 AC 82 ms
8,688 KB
testcase_27 AC 16 ms
7,680 KB
testcase_28 AC 16 ms
7,772 KB
testcase_29 AC 16 ms
7,760 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n=int(input())
s=input()
ab=s.count("A")+s.count("B")

mod=998244353
ans1=1
ans2=1
for i in range(ab):
    ans1=ans1*(n-i)%mod
    ans2=ans2*(i+1)%mod
print(ans1*pow(ans2,mod-2,mod)%mod)
0