結果
| 問題 | No.3458 Scores of Subsequence |
| コンテスト | |
| ユーザー |
startcpp
|
| 提出日時 | 2026-02-28 14:42:44 |
| 言語 | C++14 (gcc 15.2.0 + boost 1.90.0) |
| 結果 |
AC
|
| 実行時間 | 9 ms / 2,000 ms |
| + 364µs | |
| コード長 | 397 bytes |
| 記録 | |
| コンパイル時間 | 337 ms |
| コンパイル使用メモリ | 76,416 KB |
| 実行使用メモリ | 5,888 KB |
| 最終ジャッジ日時 | 2026-07-25 06:00:08 |
| 合計ジャッジ時間 | 1,996 ms |
|
ジャッジサーバーID (参考情報) |
judge2_0 / judge3_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 25 |
ソースコード
#include <iostream>
#include <string>
#include <atcoder/modint>
#define rep(i, n) for(i = 0; i < n; i++)
using namespace std;
using namespace atcoder;
using mint = modint998244353;
int main() {
string s; cin >> s;
int n = s.length();
int cntM = 0, i;
mint ans = 0;
rep(i, n) {
if (s[i] == 'M') { cntM++; }
else { ans += mint(3).pow(cntM); }
}
cout << ans.val() << endl;
return 0;
}
startcpp