結果
| 問題 |
No.805 UMG
|
| コンテスト | |
| ユーザー |
TAISA_
|
| 提出日時 | 2019-03-22 21:25:02 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 24 ms / 2,000 ms |
| コード長 | 619 bytes |
| コンパイル時間 | 1,565 ms |
| コンパイル使用メモリ | 166,236 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2024-11-18 13:12:11 |
| 合計ジャッジ時間 | 2,479 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 25 |
ソースコード
#include <bits/stdc++.h>
#define mp make_pair
#define all(vec) vec.begin(), vec.end()
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
const ll INF = 1LL << 30;
const ll LINF = 1LL << 60;
const double eps = 1e-9;
const ll MOD = 1000000007LL;
int main() {
int n;
cin >> n;
string s;
cin >> s;
int ans = 0;
for(int i = 0; i < n; i++) {
if(s[i] != 'U') continue;
for(int j = i + 2; j < n; j++) {
if(s[j] != 'G') continue;
if((j - i) % 2) continue;
if(s[i + (j - i) / 2] == 'M') ans++;
}
}
cout << ans << endl;
}
TAISA_