結果

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

ソースコード

diff #

#include<iostream>
#include<string>
using namespace std;
int main(void){
	int d; string str, tmp; cin >> d >> str >> tmp;
	str = "xxxxxxxxxxxxxx" + str + tmp + "xxxxxxxxxxxxxx";
	string s = str;
	int ans = 0;
	for (int i = 0; i < s.size(); i++){
		s = str;
		for (int j = 0; j < d && i+j < s.size(); j++){
			if (s[i + j] == 'o') break;
			s[i + j] = 'o';
		}
		int cnt = 0;
		for (int j = 0; j < s.size(); j++){
			((s[j] == 'o')? cnt++ : cnt = 0);
			if (cnt > ans) ans = cnt;
		}
	}
	cout << ans << endl;
	return 0;
}
0