結果
問題 |
No.204 ゴールデン・ウィーク(2)
|
ユーザー |
![]() |
提出日時 | 2015-10-23 14:26:05 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 827 bytes |
コンパイル時間 | 505 ms |
コンパイル使用メモリ | 58,328 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-10-13 13:40:11 |
合計ジャッジ時間 | 1,656 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 23 WA * 23 |
ソースコード
#include<iostream> #include<string> #include<algorithm> int main() { int holiday; std::string weeks, s; std::cin >> holiday; std::cin >> s; weeks = s; std::cin >> s; weeks += s; int max = holiday; //ゴールデンウィークの前から有給をとる場合 for (int i = 0; weeks[i] == 'o'; i++) { max++; } for (int i = 0; i < weeks.length(); i++) { int count = 0, holi_num = 0; bool flag = false; for (int j = i; j < weeks.length(); j++) { if (flag && weeks[j] == 'x')break; while (weeks[j] == 'x') { count++; if (count == holiday || j >= weeks.length() || weeks[j + 1] == 'o') { flag = true; break; } holi_num++; j++; } holi_num++; } if(!flag)holi_num += holiday - count; max = std::max(max, holi_num); } std::cout << max << std::endl; return 0; }