求助6个点RE怎么解决?

P2799 国王的魔镜

@[dffgg小翟](/space/show?uid=29612) 字符串开小了………………
by 准点的星辰 @ 2018-07-03 16:37:11


正解了解下 #include<iostream> #include<cstring> #include<cstdio> #include<cstdlib> using namespace std; string f; int main() { cin>>f; int k=f.size(); if(f[0]!=f[k-1]) cout<<k; else { int n=k; while(n!=0) { if(f[0]==f[n-1]&&f[n/2-1]==f[n/2]&&n%2==0) n=n/2; else { cout<<n<<endl; break; } } } return 0; }
by warm_sun @ 2018-07-03 16:39:05


@[dffgg小翟](/space/show?uid=29612) 尽量不要用gets(),会编译错误的(本人亲自在此题跳的坑)。
by sss7020 @ 2018-07-03 17:04:04


貌似不是数组太小的锅 开到100010有一个点由RE变成了WA。。。。。。@[准点的星辰](/space/show?uid=54502)
by vectorfox @ 2018-07-03 21:30:00


问题已解决 cout<<len/asd/2; 当一次对折都没有的时候 程序会除以0
by vectorfox @ 2018-07-06 15:19:37


|