

Time Limit: 2 sec / Memory Limit: 1024 MB
配点 : 点
問題文
十進法ですべての桁の数字が である整数をレピュニットと呼びます。レピュニットを小さい順に並べると です。
ちょうど つのレピュニットの和として表せる整数のうち 番目に小さいものを求めてください。
制約
- は 以上 以下の整数
入力
入力は以下の形式で標準入力から与えられる。
出力
答えを出力せよ。
入力例 1Copy
5
出力例 1Copy
113
ちょうど つのレピュニットの和として表せる整数を小さい順に並べると です。例えば は と表せます。
つのレピュニットは相異ならなくてもよいことに注意してください。
入力例 2Copy
19
出力例 2Copy
2333
入力例 3Copy
333
出力例 3Copy
112222222233
Score : points
Problem Statement
A repunit is an integer whose digits are all in decimal representation. The repunits in ascending order are .
Find the -th smallest integer that can be expressed as the sum of exactly three repunits.
Constraints
- is an integer between and , inclusive.
Input
The input is given from Standard Input in the following format:
Output
Print the answer.
Sample Input 1Copy
5
Sample Output 1Copy
113
The integers that can be expressed as the sum of exactly three repunits are in ascending order. For example, can be expressed as .
Note that the three repunits do not have to be distinct.
Sample Input 2Copy
19
Sample Output 2Copy
2333
Sample Input 3Copy
333
Sample Output 3Copy
112222222233