1 solutions

  • 0
    @ 2026-5-4 8:45:14
    #include<bits/stdc++.h>
    using namespace std;
    int main()
    {	
    	string s,t;
    	cin>>s>>t;
    	for(int w=1;w<s.size();w++) //枚举区间长度
    	{
    		for(int c=0;c<w;c++) //枚举起点
    		{
    			string now;
    			for(int i=c;i<s.size();i+=w)
    			{
    				now+=s[i]; //拼接字符串
    			}
    			if(now==t)
    			{
    				cout<<"Yes"<<endl;
    				return 0;
    			}
    		}
    	}
    	cout<<"No"<<endl;
    	return 0;
    }
    
    
    
    • 1

    Information

    ID
    2672
    Time
    1000ms
    Memory
    256MiB
    Difficulty
    3
    Tags
    # Submissions
    23
    Accepted
    14
    Uploaded By