QOJ.ac

QOJ

Limite de temps : 2 s Limite de mémoire : 1024 MB Points totaux : 100

#23993. 문자열 찾기

Statistiques

문제 설명

길이 $N$인 문자열 $S$와 길이 $M$인 문자열 $T$, 그리고 양의 정수 $K$가 주어진다. $S$와 $T$의 각 문자는 영어 소문자이다.

$S$를 $K$번 반복한 문자열을 $X$라고 하자. $X$의 부분 문자열로서 $T$가 포함된다면 Yes를, 그렇지 않다면 No를 출력하여라. 단, $X$의 부분 문자열이란 $X$의 맨 앞에서 $0$글자 이상, $X$의 맨 뒤에서 $0$글자 이상을 삭제하여 얻을 수 있는 문자열을 뜻한다.

제약 조건

  • $1 \le N \le 100$.
  • $S$는 영어 소문자로만 이루어진 길이 $N$인 문자열이다.
  • $1 \le M \le 100$.
  • $T$는 영어 소문자로만 이루어진 길이 $M$인 문자열이다.
  • $1 \le K \le 10^9$.
  • $N, M, K$는 정수이다.

서브태스크

  1. ($25$점) $K = 1$.
  2. ($25$점) $K \le 100$.
  3. ($25$점) $S, T$의 각 문자는 a이다.
  4. ($25$점) 추가 제약 조건이 없다.

입력

입력은 다음 형식으로 주어진다.

N
S
M
T
K

출력

$X$의 부분 문자열로서 $T$가 포함된다면 Yes를, 그렇지 않다면 No를 출력하여라.

답 이외에는 아무것도 출력하지 말 것. (입력을 유도하는 문장 등도 출력하지 말 것.)

답안 형식에 대해서는 연습문제와 그 해답 예시를 참고해도 좋다.

예제 1

입력

4
joig
3
joi
1

출력

Yes

$X$는 joig이며, 부분 문자열로서 joi를 포함한다. 따라서 Yes를 출력한다.

이 입력 예제는 서브태스크 $1, 2, 4$의 제약 조건을 만족한다.

예제 2

입력

3
joi
4
joig
2

출력

No

$X$는 joijoi이며, 부분 문자열로서 joig를 포함하지 않는다. 따라서 No를 출력한다.

이 입력 예제는 서브태스크 $2, 4$의 제약 조건을 만족한다.

예제 3

입력

4
aaaa
1
a
1000000000

출력

Yes

$X$는 $4 \times 10^9$개의 a로 이루어진 문자열이며, 부분 문자열로서 a를 포함한다. 따라서 Yes를 출력한다.

이 입력 예제는 서브태스크 $3, 4$의 제약 조건을 만족한다.

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.