标签:question list html 包含 bcd group alt gets 超时
现在问题是给定一个字符串,判断他是否可以由一个对串旋转任意次得到。
第1行:给出一个字符串(字符串非空串,只包含小写字母,长度不超过1000000)
对于每个测试用例,输出结果占一行,如果能,输出YES,否则输出NO。
aa ab
YES NO题目链接:http://www.51nod.com/onlineJudge/questionCode.html#!problemId=1347
1 #include <bits/stdc++.h>
2 using namespace std;
3 int main()
4 {
5 char s[1000005];
6 while(gets(s))
7 {
8 int count=1;
9 int len=strlen(s);
10 int t=len/2;
11 if(len%2!=0)
12 printf("NO\n");
13 else
14 {
15 for(int i=0;i<len/2;i++)
16 {
17 if(s[i]!=s[i+t])
18 {
19 count=0;
20 break;
21 }
22 }
23 if(count)
24 printf("YES\n");
25 else printf("NO\n");
26 }
27 }
28 return 0;
29 }
标签:question list html 包含 bcd group alt gets 超时
原文地址:http://www.cnblogs.com/yechanglv/p/6941980.html