結果
問題 | No.805 UMG |
ユーザー |
![]() |
提出日時 | 2020-02-13 23:43:40 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 19 ms / 2,000 ms |
コード長 | 306 bytes |
コンパイル時間 | 1,298 ms |
コンパイル使用メモリ | 167,172 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-11-18 13:58:47 |
合計ジャッジ時間 | 2,129 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 25 |
ソースコード
#include <bits/stdc++.h> using namespace std; int main() { int N; string S; cin >> N >> S; int ans = 0; for (int m = 0; m < N; m++) if (S.at(m) == 'M') for (int u = 0, g; u < m; u++) if (S.at(u) == 'U' && (g = m + (m - u)) < N && S.at(g) == 'G') ans++; cout << ans << "\n"; }