結果

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

ソースコード

diff #

#include <iostream>
#include <algorithm>
using namespace std;
int main(){
	int d;	cin>>d;
	string a,b,c;
	cin>>a;	cin>>b;
	c="xxxxxxxxxxxxxx";
	a=c+a+b+c;//14*3=42words
	int cnt=0,ans=0;
	for(int i=0;i+d<=42;i++){
		b=a;
		for(int j=0;j<d;j++){
			if(b[i+j]=='o')	break;
			b[i+j]='o';
		}
		cnt=0;
		for(int j=0;j<42;j++){
			if(b[j]=='x'){
				ans=max(ans,cnt);
				cnt=0;
			}
			else if(b[j]=='o')	cnt++;
		}
		ans=max(ans,cnt);
		b.clear();
	}
	cout<<ans<<endl;
	return 0;
}
0