結果

問題 No.1927 AB-CD
ユーザー dangodango
提出日時 2023-06-16 20:33:28
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 79 ms / 2,000 ms
コード長 191 bytes
コンパイル時間 285 ms
コンパイル使用メモリ 87,136 KB
実行使用メモリ 76,608 KB
最終ジャッジ日時 2023-09-06 17:50:34
合計ジャッジ時間 3,905 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
71,532 KB
testcase_01 AC 73 ms
71,520 KB
testcase_02 AC 72 ms
71,316 KB
testcase_03 AC 75 ms
71,380 KB
testcase_04 AC 79 ms
76,096 KB
testcase_05 AC 74 ms
76,300 KB
testcase_06 AC 75 ms
76,144 KB
testcase_07 AC 76 ms
76,232 KB
testcase_08 AC 71 ms
75,976 KB
testcase_09 AC 76 ms
76,344 KB
testcase_10 AC 75 ms
76,092 KB
testcase_11 AC 73 ms
76,380 KB
testcase_12 AC 74 ms
75,832 KB
testcase_13 AC 74 ms
75,848 KB
testcase_14 AC 72 ms
75,824 KB
testcase_15 AC 73 ms
75,656 KB
testcase_16 AC 75 ms
76,116 KB
testcase_17 AC 75 ms
76,120 KB
testcase_18 AC 73 ms
76,196 KB
testcase_19 AC 73 ms
76,196 KB
testcase_20 AC 75 ms
76,380 KB
testcase_21 AC 75 ms
76,448 KB
testcase_22 AC 73 ms
75,756 KB
testcase_23 AC 75 ms
76,364 KB
testcase_24 AC 75 ms
76,460 KB
testcase_25 AC 76 ms
76,540 KB
testcase_26 AC 75 ms
76,608 KB
testcase_27 AC 67 ms
71,580 KB
testcase_28 AC 67 ms
71,428 KB
testcase_29 AC 68 ms
71,528 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
S = input()
AB = S.count("A") + S.count("B")
M = 998244353
R1, R2 = 1, 1
for i in range(AB):
  R1 = R1 * (N - i) % M
  R2 = R2 * (i + 1) % M
print(R1 * pow(R2, M - 2, M) % M)
0