100 atcoder#ABC161D. [ABC161D] Lunlun Number
[ABC161D] Lunlun Number
Score : points
Problem Statement
A positive integer is said to be a lunlun number if and only if the following condition is satisfied:
- In the base ten representation of (without leading zeros), for every pair of two adjacent digits, the absolute difference of those digits is at most .
For example, , , and are lunlun numbers, while none of , , or is.
You are given a positive integer . Find the -th smallest lunlun number.
Constraints
- All values in input are integers.
Input
Input is given from Standard Input in the following format:
Output
Print the answer.
15
23
We will list the smallest lunlun numbers in ascending order: , , , , , , , , , , , , , , . Thus, the answer is .
1
1
13
21
100000
3234566667
Note that the answer may not fit into the -bit signed integer type.