結果
| 問題 |
No.805 UMG
|
| コンテスト | |
| ユーザー |
Konton7
|
| 提出日時 | 2019-11-26 22:11:04 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 13 ms / 2,000 ms |
| コード長 | 486 bytes |
| コンパイル時間 | 520 ms |
| コンパイル使用メモリ | 70,984 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2024-11-18 13:54:54 |
| 合計ジャッジ時間 | 1,294 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 25 |
ソースコード
#include <iostream>
#include <algorithm>
#include <math.h>
using namespace std;
int main(){
int n, ans, l, r, d;
ans = 0;
cin >> n;
string s;
cin >> s;
for ( int i = 0; i < n; i++ ){
if ( s[i] == 'M' ) {
l = i, r = n-1-i;
d = min(l, r);
for ( int j = 1; j < d+1; j++ ){
if ( s[i-j] == 'U' && s[i+j] == 'G' ) {
ans ++;
}
}
}
}
cout << ans << endl;
return 0;
}
Konton7