結果

問題 No.1927 AB-CD
ユーザー Akijin_007Akijin_007
提出日時 2022-05-06 21:38:33
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 372 ms / 2,000 ms
コード長 457 bytes
コンパイル時間 299 ms
コンパイル使用メモリ 87,236 KB
実行使用メモリ 82,472 KB
最終ジャッジ日時 2023-09-20 02:31:30
合計ジャッジ時間 8,435 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 93 ms
71,860 KB
testcase_01 AC 95 ms
71,568 KB
testcase_02 AC 94 ms
71,576 KB
testcase_03 AC 94 ms
71,604 KB
testcase_04 AC 310 ms
81,324 KB
testcase_05 AC 301 ms
81,088 KB
testcase_06 AC 293 ms
81,232 KB
testcase_07 AC 272 ms
80,728 KB
testcase_08 AC 120 ms
78,008 KB
testcase_09 AC 314 ms
81,384 KB
testcase_10 AC 259 ms
80,532 KB
testcase_11 AC 283 ms
80,804 KB
testcase_12 AC 186 ms
78,944 KB
testcase_13 AC 201 ms
79,184 KB
testcase_14 AC 113 ms
77,804 KB
testcase_15 AC 145 ms
78,364 KB
testcase_16 AC 291 ms
80,916 KB
testcase_17 AC 240 ms
80,064 KB
testcase_18 AC 252 ms
80,264 KB
testcase_19 AC 265 ms
80,564 KB
testcase_20 AC 328 ms
81,720 KB
testcase_21 AC 270 ms
80,396 KB
testcase_22 AC 172 ms
78,624 KB
testcase_23 AC 344 ms
81,920 KB
testcase_24 AC 372 ms
82,468 KB
testcase_25 AC 372 ms
82,216 KB
testcase_26 AC 369 ms
82,472 KB
testcase_27 AC 93 ms
71,712 KB
testcase_28 AC 93 ms
71,568 KB
testcase_29 AC 93 ms
71,604 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#int(input())
#map(int, input().split())
#list(map(int, input().split()))

N = int(input())
S = input()

mod = 998244353

t = 1

m = N

fac = [1] * (m+1)
facinv = [1] * (m+1)

for i in range(1, m+1):
    fac[i] = (fac[i-1] * i) % mod
    facinv[i] = (facinv[i-1] * pow(i, mod-2, mod)) % mod

def nCk(n, k):
    return (fac[n] * facinv[k] * facinv[n-k]) % mod

from collections import Counter

c = Counter()

a = S.count("A") + S.count("B")

print(nCk(N, a))
0