結果

問題 No.805 UMG
ユーザー sigmani
提出日時 2022-03-08 20:15:23
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 22 ms / 2,000 ms
コード長 263 bytes
コンパイル時間 1,504 ms
コンパイル使用メモリ 166,296 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-11-18 14:14:28
合計ジャッジ時間 2,512 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 25
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
int main(){
  int N;
  cin>>N;
  string S;
  cin>>S;
  long long count=0;
  for(int i=0;i<=N-1;i++){
    for(int j=i+1;j<=N-1;j++){
      if(S[i]=='U'&&S[j]=='M'&&S[2*j-i]=='G')count++;
    }
  }
  cout<<count<<endl;
}
0