且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

hdu 2203 亲和串

更新时间:2022-08-13 08:49:06

http://acm.hdu.edu.cn/showproblem.php?pid=2203
就是用两个函数就搞定了:

#include <iostream>
#include <cstring>
#include <cstdio>
using namespace std;
char st[100005];
char st1[100005];
char st2[200005];
int main()
{
    while(cin>>st1>>st2)
    {
        strcpy(st,st1);//先复制
        strcat(st,st1);//然后接上
        if(strstr(st,st2) == NULL)//再找
            puts("no");
        else
            puts("yes");
    }
    return 0;
}