結果
問題 |
No.203 ゴールデン・ウィーク(1)
|
ユーザー |
|
提出日時 | 2016-04-09 15:05:49 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 2 ms / 1,000 ms |
コード長 | 917 bytes |
コンパイル時間 | 469 ms |
コンパイル使用メモリ | 62,516 KB |
実行使用メモリ | 6,824 KB |
最終ジャッジ日時 | 2024-11-18 09:40:32 |
合計ジャッジ時間 | 1,338 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 29 |
ソースコード
#include <iostream> #include <string> #include <vector> #include <algorithm> using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(0); vector<int> vec; char prev = 'a'; //インプットがx,oだけなので char curr = 'a'; //それ以外の適当な文字aで初期化 int count = 0; for (int i = 0; i < 14; ++i) { cin >> curr; if (prev == 'a') { //最初だけ prev = curr; if (curr == 'o') { count = 1; } continue; } if (prev != curr) { if (prev == 'o') { vec.push_back(count); } count = 1; } else { if (prev =='o') { count++; } } prev = curr; } vec.push_back(count); cout << *max_element(vec.begin(), vec.end()) << endl; return 0; }