結果
問題 |
No.204 ゴールデン・ウィーク(2)
|
ユーザー |
![]() |
提出日時 | 2016-07-23 11:24:01 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 556 bytes |
コンパイル時間 | 546 ms |
コンパイル使用メモリ | 59,180 KB |
実行使用メモリ | 6,824 KB |
最終ジャッジ日時 | 2024-11-06 14:50:15 |
合計ジャッジ時間 | 2,014 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 21 WA * 25 |
ソースコード
#include<iostream> #include<string> using namespace std; int cal(string s){ int ret=0, cnt=0; for(int i=0; i<s.size(); i++){ if(s[i]=='o'){ cnt++; ret=max(ret, cnt); }else{ cnt=0; } } return ret; } int main(){ int D; cin>> D; string c1, c2; cin>> c1>> c2; auto C=c1+c2; int ans=-1; for(int i=0; i<=14-D; i++){ auto s=C.substr(0, i)+string(D, 'o')+C.substr(i+D); ans=max(ans, cal(s)); } cout<< ans<< endl; return 0; }