結果

問題 No.805 UMG
ユーザー iryuki
提出日時 2020-02-15 12:56:23
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 430 bytes
コンパイル時間 1,395 ms
コンパイル使用メモリ 167,456 KB
実行使用メモリ 6,824 KB
最終ジャッジ日時 2024-11-18 13:58:53
合計ジャッジ時間 2,460 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 5 WA * 20
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

int main(){
    int n;cin>>n;
    ll 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;
}
0