結果
問題 | No.1927 AB-CD |
ユーザー | platinum |
提出日時 | 2022-05-06 22:25:51 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 32 ms / 2,000 ms |
コード長 | 461 bytes |
コンパイル時間 | 2,554 ms |
コンパイル使用メモリ | 194,980 KB |
最終ジャッジ日時 | 2025-01-29 03:43:12 |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 27 |
ソースコード
#include <bits/stdc++.h> #include <atcoder/modint> #define rep(i,n) for(int i = 0; i < (int)(n); i++) using namespace std; using namespace atcoder; using LL = long long; using mint = modint998244353; int main(){ int N; string S; cin >> N >> S; int num = 0; rep(i,N) if(S[i] == 'A' || S[i] == 'B') num++; mint ans = 1; rep(i,num){ ans *= N - i; ans /= i + 1; } cout << ans.val() << endl; return 0; }