結果
問題 | No.204 ゴールデン・ウィーク(2) |
ユーザー |
![]() |
提出日時 | 2015-05-12 18:54:38 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 2 ms / 1,000 ms |
コード長 | 503 bytes |
コンパイル時間 | 713 ms |
コンパイル使用メモリ | 59,732 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-12-24 11:45:01 |
合計ジャッジ時間 | 2,131 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 46 |
ソースコード
#include <iostream> #include <string> #include <algorithm> using namespace std; int main() { int d; string s, t; while (cin>>d>>s>>t) { s+=t; s=string(14, 'x')+s+string(14, 'x'); t=s; int res=0; for(int i=0;i<s.size();++i) { for(int j=0;i+j<s.size()&&j<d&&s[i+j]=='x';++j) s[i+j]='o'; for(int j=1;j<=s.size();++j) if (s.find(string(j, 'o'))!=s.npos) res=max(res, j); s=t; } cout<<res<<endl; } }