結果
| 問題 |
No.805 UMG
|
| コンテスト | |
| ユーザー |
pekko
|
| 提出日時 | 2019-06-01 22:53:12 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 41 ms / 2,000 ms |
| コード長 | 381 bytes |
| コンパイル時間 | 621 ms |
| コンパイル使用メモリ | 65,500 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2024-11-18 13:50:07 |
| 合計ジャッジ時間 | 1,580 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 25 |
ソースコード
#include <iostream>
#include <string>
using namespace std;
int main(){
int N;
cin >> N;
string S;
cin >> S;
int cnt = 0;
int width = 1;
while(width <= N/2){
for(int i = 0;i < N;i++){
if(i + 2 * width > N)break;
else{
if(S[i] == 'U' && S[i+width] == 'M' && S[i+2*width] == 'G')cnt++;
}
}
width++;
}
cout << cnt << endl;
}
pekko