| 记录编号 | 583378 | 评测结果 | AAAAAAAAAA | ||
|---|---|---|---|---|---|
| 题目名称 | 3318.[USACO19 DEC Bronze]Where Am I? | 最终得分 | 100 | ||
| 用户昵称 | 是否通过 | 通过 | |||
| 代码语言 | C++ | 运行时间 | 0.000 s | ||
| 提交时间 | 2023-10-12 21:32:19 | 内存使用 | 0.00 MiB | ||
#include <bits/stdc++.h>
using namespace std;
const int N = 110;
int n;
int nx[N];
string c;
bool check(int x){
for(int i = 0;i+x-1 < n;i++){
string s = c.substr(i,x);
for(int j = i+1;j+x-1 < n;j++)
if(s == c.substr(j,x))return 0;
}
return 1;
}
int main(){
freopen("whereami.in","r",stdin);
freopen("whereami.out","w",stdout);
scanf("%d",&n);cin>>c;
for(int i = 1;i <= n;i++){
if(check(i)){
printf("%d\n",i);
break;
}
}
return 0;
}