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

34428번 - encryptedcounting 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 2048 MB26222083.333%

문제

You and your friends have devised a clever method of encrypting numbers and have been using the method to talk to each other for the past few days. Unfortunately, your decryption tool broke so you need to create a new one.

The encryption is based on a sequence, where the next element of the sequence is derived by the "spoken" representation of the previous element. The encrypted version of a number, $M,ドル is derived by finding the $M^{th}$ member of the sequence starting from some initial seed, $S$. To decrypt a ciphertext, $C,ドル one needs to find how many $M$ iterations it took to reach that $C$ from the given seed, $S$.

Here is an example of how the sequence is generated:

// Comments describe how the number on the left 
// was generated from the previous number.
0. 12 // "12" is our seed
1. 1112 // "12" is "one one" and "one two" -> 11, 12 -> 1112
2. 3112 // "1112" is "three ones" and "one two" -> 31, 12 -> 3112
3. 132112 // "3112" is "one three" and "two ones" and "one two" -> 132112
4. 1113122112
5. 311311222112

Your friend sends you a single line containing the seed, $S,ドル and the ciphertext, $C$. Output the decrypted number, $M,ドル which describes the number of iterations your encryption algorithm takes to reach $C$ when starting at $S$.

입력

Two integers, $S$ and $C,ドル that are separated by a space. $S$ has less than 10ドル$ digits, and $C$ has less than 200ドル$ digits. Suppose the input is:

12 132112

where $S = 12$ and $C = 132112$. You then need to calculate, $M,ドル which would be 3ドル$ in this case (since the third iteration of the seed produces 132112ドル$).

출력

Output a single integer, $M,ドル that is the number of iterations it takes to reach $C$ from the seed $S$. The output for the above example would look like:

3

제한

예제 입력 1

12 132112

예제 출력 1

3

예제 입력 2

21 13211311123113112211

예제 출력 2

7

노트

출처

School > CS@Mines > CS@Mines HSPC 2020 E번

  • 문제를 만든 사람: Fisher Darling
(追記) (追記ここまで)

출처

대학교 대회

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

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