시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 1024 MB8010913.846%

문제

Smoothly undulating numbers alternate between a pair of digits (e.g., 1212121). Double smoothly undulating numbers alternate between a pair of digits in one number base and a pair (potentially different) of digits in some other number base. Consider the number 191919 in base 10. This number is 121212 when represented in base 11. So, 191919 (in base 10) is a double smoothly undulating number.

Similarly, there are triple undulating numbers (which are smoothly undulating in three bases) and even quadruple smoothly undulating numbers, like 300 (base 10), which is:

  • 606 (base 7)
  • 454 (base 8)
  • 363 (base 9)
  • 1A1 (base 13)

Your task will be to find double, triple, and quadruple smoothly undulating numbers.

입력

A single line with five integers:

  • The lowest base to examine (2..32)
  • The highest base to examine (2..32)
  • The lowest number in the range of numbers to search (1..10000000)
  • The highest number in the range of numbers to search (1..10000000)
  • The number 2, 3, or 4 for double, triple, or quadruple undulating numbers, respectively

출력

A sort of list of numbers in base 10 that meet the input criteria.

예제 입력 1

10 11 190000 950000 2

예제 출력 1

191919
383838
575757
767676
959595