跳到正文

题解

题解:AT_joi2027_yo1b_d ペア (Pairs)

pigeon4836约 1 分钟
原文
文章信息与版本

文章信息

发布
2026年11月22日
收录
2026年11月26日
更新
2026年11月26日
篇幅
约 1 分钟

版本

  1. v1当前

传送门

题目大意

问字符串 ss 重复 kk 遍之后是否包含另一个字符串 tt。

分析

发现两个字符串都很短,但是 kk 非常大,很显然 kk 是用不着这么大的,所以只要把 kk 缩到一个不大的数然后模拟就可以了。

Code

C++
#include<iostream>
#include<string>
using namespace std;
int main(){
	int n,m,k;
	string s,t,x;
	cin>>n>>s>>m>>t>>k;
	if(k>105)
		k=105;
	while(k--)
		x+=s;
	if(x.find(t)!=string::npos)
		cout<<"Yes";
	else
		cout<<"No";
	return 0;
}

提交记录

原文