結果

問題 No.805 UMG
ユーザー sinsincoscos
提出日時 2019-03-17 13:52:55
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 18 ms / 2,000 ms
コード長 311 bytes
コンパイル時間 519 ms
コンパイル使用メモリ 56,264 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-11-18 13:08:43
合計ジャッジ時間 1,628 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 25
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
using namespace std;

int N;
string S;
int main(){
    cin >> N >> S;
    int ans = 0;
    for(int i=0;i<N-1;i++){
        for(int j=i+1;j<N;j++){
            if((i+j)%2==1) continue;
            if(S[i]=='U' && S[(i+j)/2]=='M' && S[j]=='G') ans++;
        }
    }
    cout << ans << endl;
}
0