結果

問題 No.805 UMG
ユーザー sinsincoscos
提出日時 2019-03-17 13:55:16
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
TLE  
(最新)
AC  
(最初)
実行時間 -
コード長 372 bytes
コンパイル時間 511 ms
コンパイル使用メモリ 55,164 KB
実行使用メモリ 13,636 KB
最終ジャッジ日時 2024-11-18 13:09:06
合計ジャッジ時間 19,523 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 20 TLE * 5
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
using namespace std;

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