結果
| 問題 |
No.204 ゴールデン・ウィーク(2)
|
| コンテスト | |
| ユーザー |
hanorver
|
| 提出日時 | 2015-10-17 23:05:13 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 770 bytes |
| コンパイル時間 | 731 ms |
| コンパイル使用メモリ | 58,664 KB |
| 実行使用メモリ | 6,824 KB |
| 最終ジャッジ日時 | 2024-10-13 13:40:03 |
| 合計ジャッジ時間 | 1,942 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 18 WA * 28 |
ソースコード
#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 = 0;
int i = 0;
while (weeks[i] == 'o') {
max++;
i++;
}
max += holiday;
for (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++;
holi_num++;
j++;
if (count == holiday || j >= weeks.length() || weeks[j] == 'o') {
flag = true;
break;
}
}
holi_num++;
}
if(!flag)holi_num += holiday - count;
max = std::max(max, holi_num);
}
std::cout << max << std::endl;
return 0;
}
hanorver