Logo
(追記) (追記ここまで)

27615번 - Pea Pattern 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 1024 MB136685446.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

1 3112

예제 출력 1

5

예제 입력 2

1 3113

예제 출력 2

Does not appear

예제 입력 3

20902 101011213141516171829

예제 출력 3

10

힌트

출처

ICPC > Regionals > North America > East Central North America Regional > 2022-2023 East Central Regional Contest G번

(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /