結果
| 問題 | 
                            No.805 UMG
                             | 
                    
| コンテスト | |
| ユーザー | 
                             | 
                    
| 提出日時 | 2020-02-15 12:55:22 | 
| 言語 | C++14  (gcc 13.3.0 + boost 1.87.0)  | 
                    
| 結果 | 
                             
                                WA
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 409 bytes | 
| コンパイル時間 | 1,523 ms | 
| コンパイル使用メモリ | 167,152 KB | 
| 実行使用メモリ | 6,820 KB | 
| 最終ジャッジ日時 | 2024-11-18 13:58:44 | 
| 合計ジャッジ時間 | 2,292 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge2 / judge1 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 5 WA * 20 | 
ソースコード
#include <bits/stdc++.h>
using namespace std;
int main(){
    int n;cin>>n;
    int ans=0;
    string s;cin>>s;
    for(int i=0;i<n-2;i++){
        for(int j=0;j<n-1;j++){
            if(2*j-i>n-1){
                break;
            }
            else{
                if(s[i]=='U'&&s[j]=='M'&&s[2*j-i]=='G'){
                    ans++;
                }
            }
        }
    }
    cout<<ans<<endl;
}