結果
| 問題 |
No.805 UMG
|
| コンテスト | |
| ユーザー |
Apoi
|
| 提出日時 | 2019-03-23 10:41:44 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 5 ms / 2,000 ms |
| コード長 | 556 bytes |
| コンパイル時間 | 649 ms |
| コンパイル使用メモリ | 62,152 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2024-11-18 13:31:17 |
| 合計ジャッジ時間 | 1,471 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 25 |
ソースコード
#include <iostream>
#include <cmath>
#include <string>
#include <algorithm>
#include <cctype>
typedef long long int ll;
using namespace std;
int main(){
int n, cnt = 0;
string data;
//標準入力を受け取る
cin >> n >> data;
//処理
for (int i = 0; i < n; ++i) {
if(data[i] != 'U')continue;
for (int j = i; j < (((double)n-(double)i-1)/2) + 1 + i; ++j) {
if((data[j] == 'M') && (data[j+j-i] == 'G')){
cnt++;
}
}
}
cout << cnt << endl;
return 0;
}
Apoi