結果

問題 No.204 ゴールデン・ウィーク(2)
ユーザー latte0119
提出日時 2015-05-16 19:11:01
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 583 bytes
コンパイル時間 1,559 ms
コンパイル使用メモリ 159,332 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-10-13 12:47:51
合計ジャッジ時間 2,812 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 21 WA * 25
権限があれば一括ダウンロードができます

ソースコード

diff #

#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;
    }

    int ans=0;

    for(int i=0;i+D<=str.size();i++){
        string s=str;
        for(int j=0;j<D;j++)s[i+j]='o';
        ans=max(ans,f(s));
    }
    cout<<ans<<endl;
}
0