結果

問題 No.805 UMG
ユーザー kikage
提出日時 2020-03-27 00:27:55
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 14 ms / 2,000 ms
コード長 313 bytes
コンパイル時間 380 ms
コンパイル使用メモリ 57,232 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-11-18 13:59:28
合計ジャッジ時間 1,249 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 25
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
using namespace std;
int main(){
    int N,cnt=0;
    string str;
    cin >> N >> str;
    for(int i=0;i+2<N;i++){
        if(str[i]!='U')continue;
        for(int k=1;i+2*k<N;k++){
            if(str[i+k]=='M' && str[i+2*k]=='G')cnt++;
        }
    }
    cout << cnt << endl;
    return 0;
}
0