結果

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

ソースコード

diff #

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