結果

問題 No.1927 AB-CD
ユーザー zutsu
提出日時 2022-05-08 10:52:50
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
TLE  
(最新)
AC  
(最初)
実行時間 -
コード長 244 bytes
コンパイル時間 307 ms
コンパイル使用メモリ 12,160 KB
実行使用メモリ 14,404 KB
最終ジャッジ日時 2025-01-18 08:14:22
合計ジャッジ時間 24,761 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 24 TLE * 3
権限があれば一括ダウンロードができます

ソースコード

diff #

import math

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

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

ans = math.factorial(N) * pow(math.factorial(ab),mod-2,mod) * pow(math.factorial(N-ab),mod-2,mod)
ans %= mod
print(ans)
0