{
  "question_id": 7426411,
  "question_title": "字符串的处理",
  "question_content": "<p>给定一个正整数N和一个由小写英文字母组成的长度N的字符串S。确定该字符串是否是某个字符串的两个副本的连接。也就是说&#xff0c;确定是否存在一个字符串T使S&#61;T&#43;T。如果S是某个字符串的两个副本的连接&#xff0c;则输出Yes;否则,直接输出No。\n例如&#xff0c;输入6&#xff08;回车&#xff09;abcabc&#xff0c;输出Yes&#xff08;回车&#xff09;Let T&#61;abc&#xff0c;and S&#61;T&#43;T。\n或者输入4&#xff08;回车&#xff09;abac&#xff0c;输出No&#xff08;回车&#xff09;结束。</p>",
  "difficulty": "简单",
  "answer_id": 53389947,
  "answer_content": "<pre>\n<code class=\"language-objectivec\">#include &lt;stdio.h&gt;\nint main() {\n    int len,i,judge&#61;0;\n    scanf(&#34;%d&#34;, &amp;len);\n    char a[len&#43;1];\n    scanf(&#34;%s&#34;, a);\n    if(len%2&#61;&#61;0) {\n        for(i&#61;0;i&lt;(len/2);i&#43;&#43;)\n            if(a[i]!&#61;a[(len/2)&#43;i]){\n                judge&#61;1;\n                break;\n            }\n        if(judge&#61;&#61;1)\n            printf(&#34;No&#34;);\n        else {\n            printf(&#34;Yes&#34;);\n        }\n    } else\n        printf(&#34;No&#34;);\n    printf(&#34;\\n&#34;);\n    return 0;\n}</code></pre>\n\n<p><img alt=\"\" height=\"735\" src=\"https://img-ask.csdnimg.cn/upload/1620392744663.png\" width=\"903\" /></p>",
  "tag_name": "c语言",
  "cpp": "#include <stdio.h>\nint main() {\n\tint len,i,judge=0;\n\tscanf(\"%d\", &len);\n\tchar a[len+1];\n\tscanf(\"%s\", a);\n\tif(len%2==0) {\n\t\tfor(i=0;i<(len/2);i++)\n\t\t\tif(a[i]!=a[(len/2)+i]){\n\t\t\t\tjudge=1;\n\t\t\t\tbreak;\n\t\t\t}\n\t\tif(judge==1)\n\t\t\tprintf(\"No\");\n\t\telse {\n\t\t\tprintf(\"Yes\");\n\t\t}\n\t} else\n\t\tprintf(\"No\");\n\tprintf(\"\\n\");\n\treturn 0;\n}",
  "topic_link": "https://bbs.csdn.net/topics/600470157",
  "status": 1,
  "keywords": "算法高阶,字符串匹配,算法问题选编,利用有限自动机进行字符串匹配",
  "license": "csdn.net",
  "notebook": {
    "cpp": "https://codechina.csdn.net/csdn/csdn-daily-code/-/jupyter/master/data/notebook/answer/ipynb/cpp/50.ipynb?type=file"
  },
  "notebook_enable": 1,
  "author": "stelladragon"
}