No.2246 1333-like Number
Problem Statement
Choose integers $a,b (a < b)$ between $1$ and $9$, inclusive, and an integer $c$ that is at least $0$. An integer $X$ that can be created by performing the following procedure is called an Ushi-like number.
- Initially, $X=10 a+b$. Repeat replacing $X$ with $10X+b$ $c$ times.
For example, $1333,27$ are Ushi-like numbers, but $1234,711,334,66,4$ are not.
Given a positive integer $N$, find the $N$-th smallest Ushi-like number.
Input
$N$
- $1\le N\le 1333333$
- $N$ is an integer.
Output
Output the $N$-th smallest Ushi-like number.
Sample
Sample 1
Input
13
Output
27
Listing the Ushi-like numbers in ascending order gives $12,13,14,15,16,17,18,19,23,24,25,26,27,...$. Since $N=13$, output $27$, the $13$-th smallest.
Sample 2
Input
74
Output
1333
Sample 3
Input
1333
Output
122222222222222222222222222222222222222
The answer may not fit in a $64$ bit integer type.
提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。
bayashiko