結果
問題 | No.1927 AB-CD |
ユーザー |
![]() |
提出日時 | 2022-05-06 21:29:57 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 65 ms / 2,000 ms |
コード長 | 376 bytes |
コンパイル時間 | 173 ms |
コンパイル使用メモリ | 82,156 KB |
実行使用メモリ | 75,896 KB |
最終ジャッジ日時 | 2024-07-05 22:40:21 |
合計ジャッジ時間 | 2,654 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 27 |
ソースコード
import sys input = sys.stdin.readline def comb(n, k, mod=10**9+7): num = den = 1 for i in range(k): num = num * (n-i) % mod den = den * (i+1) % mod return num * pow(den, mod-2, mod) % mod N = int(input()) S = input().rstrip() x = y = 0 for c in S: if c in "AB": x += 1 else: y += 1 mod = 998244353 print(comb(x+y, y, mod))