結果
問題 |
No.805 UMG
|
ユーザー |
![]() |
提出日時 | 2019-03-23 10:42:08 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 13 ms / 2,000 ms |
コード長 | 556 bytes |
コンパイル時間 | 718 ms |
コンパイル使用メモリ | 87,460 KB |
最終ジャッジ日時 | 2025-01-07 00:08:59 |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
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; }