結果

問題 No.204 ゴールデン・ウィーク(2)
ユーザー hanorverhanorver
提出日時 2015-10-17 23:05:13
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 770 bytes
コンパイル時間 747 ms
コンパイル使用メモリ 58,200 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-21 14:52:34
合計ジャッジ時間 1,853 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 1 ms
5,376 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 WA -
testcase_04 AC 2 ms
5,376 KB
testcase_05 AC 2 ms
5,376 KB
testcase_06 AC 2 ms
5,376 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 AC 2 ms
5,376 KB
testcase_23 WA -
testcase_24 AC 2 ms
5,376 KB
testcase_25 AC 2 ms
5,376 KB
testcase_26 AC 2 ms
5,376 KB
testcase_27 AC 2 ms
5,376 KB
testcase_28 AC 2 ms
5,376 KB
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 AC 2 ms
5,376 KB
testcase_33 AC 1 ms
5,376 KB
testcase_34 AC 2 ms
5,376 KB
testcase_35 AC 2 ms
5,376 KB
testcase_36 WA -
testcase_37 WA -
testcase_38 WA -
testcase_39 AC 2 ms
5,376 KB
testcase_40 WA -
testcase_41 AC 2 ms
5,376 KB
testcase_42 AC 2 ms
5,376 KB
testcase_43 WA -
testcase_44 WA -
testcase_45 WA -
testcase_46 WA -
testcase_47 AC 2 ms
5,376 KB
testcase_48 AC 1 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#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;
}
0