結果

問題 No.805 UMG
ユーザー mzkr
提出日時 2019-05-06 06:09:12
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 22 ms / 2,000 ms
コード長 311 bytes
コンパイル時間 617 ms
コンパイル使用メモリ 65,308 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-11-18 13:47:16
合計ジャッジ時間 1,518 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 25
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <string>

using namespace std;

int main() {
  int n;
  string s;
  int c = 0;
  cin >> n >> s;
  for (int i = 0; i < n-2; ++i) {
    for (int j = i+1; j < n-1; ++j) {
      int k = 2*j - i;
      if (s[i] == 'U' && s[j] == 'M' && s[k] == 'G') c++;
    }
  }

  cout << c << endl;
}
0