记录编号 571161 评测结果 AAWAWWWWAW
题目名称 3318.[USACO19 DEC Bronze]Where Am I? 最终得分 40
用户昵称 ┭┮﹏┭┮ 是否通过 未通过
代码语言 C++ 运行时间 0.000 s
提交时间 2022-05-10 21:07:46 内存使用 0.00 MiB
显示代码纯文本
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <string>
using namespace std;
int n,k = 0;
char a[110];
bool f;
bool sou(int x){
	int l = 0;
	for(int j = x;j <= x+k;j++,l++){
		if(a[l] != a[j])return 0; 
	}
	return 1;
}
int main(){
	freopen("whereami.in","r",stdin);
	freopen("whereami.out","w",stdout);
	scanf("%d%s",&n,&a);
	while(k < n){
		f = 0;
		for(int i = k+1;i <= n-k-1;i++){
			if(sou(i) == 1){
				f = 1;
				break; 
			}
		}
		if(f == 0){
			printf("%d\n",k+1);
			return 0;
		}
		k++;
	}
 
	return 0; 
}