結果

問題 No.3370 AB → BA
コンテスト
ユーザー kotatsugame
提出日時 2025-11-17 21:38:10
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 333 bytes
コンパイル時間 551 ms
コンパイル使用メモリ 65,056 KB
実行使用メモリ 7,848 KB
最終ジャッジ日時 2025-11-17 21:38:23
合計ジャッジ時間 1,517 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 10 WA * 10
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<cassert>
#include<atcoder/modint>
using namespace std;
using mint=atcoder::modint998244353;
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	string S;cin>>S;
	mint ans=1;
	int emp=0;
	for(int i=0;i<S.size();i++)
	{
		emp++;
		if(S[i]=='A')
		{
			ans*=emp--;
		}
	}
	cout<<ans.val()<<endl;
}
0