結果
| 問題 |
No.805 UMG
|
| コンテスト | |
| ユーザー |
treeone
|
| 提出日時 | 2019-03-22 21:38:04 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 6 ms / 2,000 ms |
| コード長 | 482 bytes |
| コンパイル時間 | 1,611 ms |
| コンパイル使用メモリ | 193,280 KB |
| 最終ジャッジ日時 | 2025-01-06 23:46:44 |
|
ジャッジサーバーID (参考情報) |
judge1 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 25 |
ソースコード
#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define int long long
using namespace std;
typedef pair<int, int> P;
const int mod = 1000000007;
const int INF = 1e18;
signed main(){
cin.tie(nullptr);
ios::sync_with_stdio(false);
int n;
cin >> n;
string s;
cin >> s;
int ans = 0;
rep(i, 0, n){
if(s[i] != 'M') continue;
for(int j = 1; i - j >= 0 && i + j < n; j++){
if(s[i - j] == 'U' && s[i + j] == 'G') ans++;
}
}
cout << ans << endl;
}
treeone