問題一覧 > 通常問題

No.2246 1333-like Number

レベル : / AI推定難易度 : 400 / 実行時間制限 : 1ケース 2.000秒 / メモリ制限 : 512 MB / 標準ジャッジ問題
タグ : (AC するまで非表示) / 解いたユーザー数 217
作問者 : bayashiko / テスター : 👑 p-adic kumakuma
お気に入りにしたユーザー ProblemId : 9183 / 自分の提出
問題文最終更新日: 2023-03-17 19:44:22
This statement was translated by AI (claude-opus-5-5, effort medium) and may contain errors or differ in nuance from the original. The original statement takes precedence. Back to the original
yukicoder contest 381 (順位表) の他の問題:

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もしくは右上の雲マークをクリックしてアカウントを作成してください。