51nod1347(简单逻辑)

题目链接:https://www.51nod.com/onlineJudge/questionCode.html#!problemId=1347

题意:中文题诶~

思路:稍推理一下就可以发现字符串a是对偶串是其可以由对偶串旋转得到的充要条件;

代码:

 1 #include <bits/stdc++.h>
 2 using namespace std;
 3 
 4 string b, a;
 5 
 6 bool is_ok(string a){
 7     int len=a.size()/2;
 8     for(int i=0; i<len; i++){
 9         if(a[i]!=a[i+len]){
10             return false;
11         }
12     }
13     return true;
14 }
15 
16 int main(void){
17     cin >> a;
18     if(a.size()&1){
19         cout << "NO" << endl;
20         return 0;
21     }
22     if(is_ok(a)){
23         cout << "YES" << endl;
24     }else{
25         cout << "NO" << endl;
26     }
27     return 0;
28 }
原文地址:https://www.cnblogs.com/geloutingyu/p/6274860.html