不明RE

P1203 [USACO1.1] 坏掉的项链 Broken Necklace

# 求包养
by rain_forest @ 2018-09-22 00:53:11


@[rain_forest](/space/show?uid=88791) 呜呜 我也一直56分......
by wxy_god @ 2018-09-22 06:43:44


# @[我是一个垃圾](/space/show?uid=89396) 但我自测是对的!
by rain_forest @ 2018-09-22 08:39:18


#我才34分,qwq ~~自测都错了,我还不要脸地提交~~
by F1aMiR3 @ 2018-09-23 21:33:02


```cpp #include <iostream> using namespace std; int main() { ios::sync_with_stdio(false); int n,maxn=-1e9; char r[350]; cin>>n; cin>>r; for(int i=0;i<n;i++) { int lcnt=0,rcnt=0,tcnt=0; char co='w'; cerr<<"RIGHT:"; for(int tmp=i+1;;tmp++) { if(tmp>=n) tmp-=n; cerr<<r[tmp]; if(r[tmp]==co) { lcnt++; } if(co!='w'&&r[tmp]!='w'&&co!=r[tmp]) { break; } if(co=='w') { co=r[tmp]; lcnt++; } } cerr<<endl; co='w'; cerr<<"LEFT:"; for(int tmp=i;;tmp--) { if(tmp<=0) tmp+=n; cerr<<r[tmp]; if(r[tmp]==co) { rcnt++; } if(co!='w'&&r[tmp]!='w'&&co!=r[tmp]) { break; } if(co=='w') { co=r[tmp]; rcnt++; } } cerr<<endl; tcnt=lcnt+rcnt; cerr<<tcnt<<endl; maxn=max(maxn,tcnt); } cout<<maxn; return 0; } ``` #求大佬 **留给有心人看**
by F1aMiR3 @ 2018-09-23 22:15:52


|