結果
問題 | No.204 ゴールデン・ウィーク(2) |
ユーザー |
![]() |
提出日時 | 2015-05-16 19:24:48 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 2 ms / 1,000 ms |
コード長 | 653 bytes |
コンパイル時間 | 1,368 ms |
コンパイル使用メモリ | 162,304 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-12-24 11:45:06 |
合計ジャッジ時間 | 2,783 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 46 |
ソースコード
#include<bits/stdc++.h>using namespace std;int f(string str){int ma=0;int cur=0;while(cur<str.size()){int cnt=0;while(cur<str.size()&&str[cur]=='o')cur++,cnt++;ma=max(ma,cnt);while(cur<str.size()&&str[cur]=='x')cur++;}return ma;}int main(){int D;string str;cin>>D;for(int i=0;i<2;i++){string s;cin>>s;str+=s;}str="xxxxxxxxxxxxxx"+str+"xxxxxxxxxxxxxx";int ans=0;for(int i=0;i<str.size();i++){string s=str;for(int j=0;j<D&&i+j<s.size()&&s[i+j]=='x';j++)s[i+j]='o';ans=max(ans,f(s));}cout<<ans<<endl;}