結果
| 問題 | 
                            No.1927 AB-CD
                             | 
                    
| コンテスト | |
| ユーザー | 
                             | 
                    
| 提出日時 | 2022-05-10 14:39:26 | 
| 言語 | PyPy3  (7.3.15)  | 
                    
| 結果 | 
                             
                                AC
                                 
                             
                            
                         | 
                    
| 実行時間 | 130 ms / 2,000 ms | 
| コード長 | 254 bytes | 
| コンパイル時間 | 252 ms | 
| コンパイル使用メモリ | 82,656 KB | 
| 実行使用メモリ | 76,476 KB | 
| 最終ジャッジ日時 | 2024-07-17 20:28:47 | 
| 合計ジャッジ時間 | 4,113 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge5 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 27 | 
ソースコード
def main():
    N = int(input())
    S = input()
    M = S.count('A') + S.count('B')
    ans = 1
    for i in range(M):
        ans = ans * (N-i) * pow(i+1, -1, 998244353)
        ans %= 998244353
    print(ans)
if __name__ == '__main__':
    main()