103332: [Atcoder]ABC333 C - Repunit Trio
Description
Score : $300$ points
Problem Statement
A repunit is an integer whose digits are all $1$ in decimal representation. The repunits in ascending order are $1, 11, 111, \ldots$.
Find the $N$-th smallest integer that can be expressed as the sum of exactly three repunits.
Constraints
- $N$ is an integer between $1$ and $333$, inclusive.
Input
The input is given from Standard Input in the following format:
$N$
Output
Print the answer.
Sample Input 1
5
Sample Output 1
113
The integers that can be expressed as the sum of exactly three repunits are $3, 13, 23, 33, 113, \ldots$ in ascending order. For example, $113$ can be expressed as $113 = 1 + 1 + 111$.
Note that the three repunits do not have to be distinct.
Sample Input 2
19
Sample Output 2
2333
Sample Input 3
333
Sample Output 3
112222222233
Output
问题描述
回文数是一个其十进制表示中所有数字都为1的整数。从小到大的回文数依次为1, 11, 111, ...。
找出能够表示为恰好三个回文数之和的第N小的整数。
限制条件
- N是一个介于1和333之间的整数。
输入
输入从标准输入中给出,格式如下:
$N$
输出
输出答案。
样例输入1
5
样例输出1
113
从小到大,能够表示为恰好三个回文数之和的整数为3, 13, 23, 33, 113, ...。例如,113可以表示为113 = 1 + 1 + 111。
注意,这三个回文数不必不同。
样例输入2
19
样例输出2
2333
样例输入3
333
样例输出3
112222222233