結果
問題 |
No.805 UMG
|
ユーザー |
|
提出日時 | 2020-12-20 17:08:33 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 15 ms / 2,000 ms |
コード長 | 348 bytes |
コンパイル時間 | 1,524 ms |
コンパイル使用メモリ | 166,744 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-11-18 14:08:38 |
合計ジャッジ時間 | 2,463 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 25 |
ソースコード
#include <bits/stdc++.h> using namespace std; int main() { int n; string s; cin >> n >> s; int cnt = 0; for (int i = 0; i < n; i++) { if (s[i] == 'M') { for (int j = 1; j <= min(n - i, i); j++) { if (s[i - j] == 'U' && s[i + j] == 'G') { cnt++; } } } } cout << cnt << endl; return 0; }