結果
問題 | No.805 UMG |
ユーザー |
![]() |
提出日時 | 2019-03-30 02:51:02 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 5 ms / 2,000 ms |
コード長 | 479 bytes |
コンパイル時間 | 677 ms |
コンパイル使用メモリ | 55,980 KB |
実行使用メモリ | 6,824 KB |
最終ジャッジ日時 | 2024-11-18 13:36:11 |
合計ジャッジ時間 | 1,282 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 25 |
ソースコード
#include <iostream> #include <string> using namespace std; int main() { int n, ans = 0; string s; cin >> n >> s; for(int i = 0; i < (int)s.size(); i++){ if(s[i] == 'U'){ for(int j = i+1; j < ((int)s.size() + i) / 2 + 1; j++){ if(s[j] == 'M'){ if(s[j*2 - i] == 'G'){ ++ans; } } } } } cout << ans << endl; return 0; }