結果

問題 No.204 ゴールデン・ウィーク(2)
ユーザー zaichu
提出日時 2016-02-03 13:54:49
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 2 ms / 1,000 ms
コード長 506 bytes
コンパイル時間 1,474 ms
コンパイル使用メモリ 160,504 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-12-24 11:51:13
合計ジャッジ時間 2,858 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 46
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

int main(){
	int d;
	cin >> d;
	string c1,c2;
	cin >> c1 >> c2;
	c1 = "xxxxxxxxxxxxxx" + c1 + c2 + "xxxxxxxxxxxxxx";
	int ans = 0;
	for(int i = 0; i < c1.size() - ans; i++){
		int count = 0, check = 0;
		bool flag = false;
		for(int j = i; j < c1.size(); j++){
			if(c1[j] == 'o' and check > 0) flag = true;
			if(c1[j] == 'x'){
				if(check == d or flag) break;
				check++;
			}
			count++;
		}
		ans = max(count,ans);
	}
	cout << ans << endl;
	return 0;
}
0