結果
| 問題 | No.805 UMG |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2019-08-01 15:41:46 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 18 ms / 2,000 ms |
| コード長 | 329 bytes |
| コンパイル時間 | 1,907 ms |
| コンパイル使用メモリ | 192,912 KB |
| 最終ジャッジ日時 | 2025-01-07 10:26:59 |
|
ジャッジサーバーID (参考情報) |
judge3 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 25 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
int n;
string s;
cin >> n >> s;
int ans = 0;
for (int i = 0; i+2 < n; i++)
for (int j = 1; i+j*2 < n; j++)
if (s[i] == 'U' && s[i+j] == 'M' && s[i+j+j] == 'G') ans++;
cout << ans << endl;
return 0;
}