题目:
http://39.106.164.46/problem.php?id=1136
代码如下:
#include<iostream>
#include<algorithm>
#include<stdio.h>
#include<cmath>
#include<queue>
#include<cstring>
#include<vector>
#include<stack>
#include<map>
#include<set>
#define MAX 105
#define INF 0x3f3f3f3f
typedef long long ll;
using namespace std;
string s;
int main(){
int t;
cin>>t;
while(t--){
cin>>s;
int len=s.length();
int ans;
for(int l=1;l<len;l++){
bool flag=true;
for(int i=0;i<len-l;i++){
if(s[i]!=s[i+l]){
flag=false;
break;
}
}
if(flag){
ans=l;
break;
}
}
cout<<ans<<endl<<endl;
}
return 0;
}
最后
以上就是阳光小兔子最近收集整理的关于PIPIOJ 1136: k周期串 简单字符串处理的全部内容,更多相关PIPIOJ内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复