結果
問題 |
No.805 UMG
|
ユーザー |
![]() |
提出日時 | 2019-03-23 10:42:31 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 15 ms / 2,000 ms |
コード長 | 556 bytes |
コンパイル時間 | 979 ms |
コンパイル使用メモリ | 70,736 KB |
実行使用メモリ | 6,824 KB |
最終ジャッジ日時 | 2024-11-18 13:31:36 |
合計ジャッジ時間 | 1,673 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
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; }