假算法卡点可以AC,建议加强数据
查看原帖
假算法卡点可以AC,建议加强数据
50604
良辰、楼主2022/3/4 21:39

88分的代码: 链接

#include <bits/stdc++.h>
using namespace std;

inline int read(){
	int x=0,t=1; char ch=getchar();
	while((ch<'0'||ch>'9')&&ch!='-') ch=getchar();
	if(ch=='-') t=-1,ch=getchar();
	while(ch<='9'&&ch>='0') x=x*10+ch-48,ch=getchar();
	return x*t;
}

#define maxn 1000010
int t;
int cnt=1;
string s;
signed main(){
	t=read();
	cin>>s;
	s=' '+s;
	int now=0;
	for(int i=1;i<s.size();++i){
		if(s[++now]==s[i]){
		}
		else{
			cnt=i; now=0;
		}
			if(now==cnt){
				now=0;
			}
	}
	cout<<cnt<<endl;
	return 0;
}

b如果是任意回文串都能hack掉这份代码
但数据只有最后一个点考虑了这种情况
而最后一个点的t又比较特殊
特判就可以卡过去
所以可以稍微加强一下数据


如果卡在88分的小伙伴们

可以参考这组数据:

9
abaabaaba
2022/3/4 21:39
加载中...