QOJ.ac

QOJ

Límite de tiempo: 2 s Límite de memoria: 1024 MB Puntuación total: 100

#23993. 尋找字串

Estadísticas

題目描述

畀定長度為 $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.