| 시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
|---|---|---|---|---|---|
| 1 초 | 1024 MB | 136 | 68 | 54 | 46.154% |
Do you see the pattern in the following sequence of numbers?
1,ドル 11, 21, 1112, 3112, 211213, 312213, \ldots$
Each term describes the makeup of the previous term in the list. For example, the term 3112ドル$ indicates that the previous term consisted of three 1ドル$'s (that's the 31ドル$ in 3112ドル$) and one 2ドル$ (that's the 12ドル$ in 3112ドル$). The next term after 3112ドル$ indicates that it contains two 1ドル$'s, one 2ドル$ and one 3ドル$. This is an example of a pea pattern.
A pea pattern can start with any number. For example, if we start with the number 20902ドル$ the sequence would proceed 202219ドル,ドル 10113219ドル,ドル 1041121319ドル,ドル and so on. Note that digits with no occurrences in the previous number are skipped in the next element of the sequence.
We know what you're thinking. You're wondering if 101011213141516171829ドル$ appears in the sequence starting with 20902ドル$. Well, this is your lucky day because you're about to find out.
Input consists of a single line containing two positive integers $n$ and $m,ドル where $n$ is the starting value for the sequence and $m$ is a target value. Both values will lie between 0ドル$ and 10ドル^{100}-1$.
If $m$ appears in the pea pattern that starts with $n,ドル display its position in the list, where the initial value is in position 1ドル$. If $m$ does not appear in the sequence, display Does not appear. We believe that all of these patterns converge on a repeating sequence within 100ドル$ numbers, but if you find a sequence with more than 100ドル$ numbers in it, display I'm bored.
1 3112
5
1 3113
Does not appear
20902 101011213141516171829
10