#4864. 321-like Searcher

0

321-like Searcher

321-like Searcher

题目描述

A positive integer xx is called a 321-like Number when it satisfies the following condition. This definition is the same as the one in Problem A.

The digits of xx are strictly decreasing from top to bottom. In other words, if xx has dd digits, it satisfies the following for every integer ii such that 1 \le i < d: (the ii-th digit from the top of xx) > (the (i+1)(i+1)-th digit from the top of xx).

Note that all one-digit positive integers are 321-like Numbers. For example, 321321, 9641096410, and 11 are 321-like Numbers, but 123123, 21092109, and 8641186411 are not. Find the KK-th smallest 321-like Number.

输入格式

The input is given from Standard Input in the following format: KK

输出格式

Print the KK-th smallest 321-like Number as an integer.

15
32
321
9610
777
983210

提示

All input values are integers. 1≤K1 \le K At least KK 321-like Numbers exist.The 321-like Numbers are (1,2,3,4,5,6,7,8,9,10,20,21,30,31,32,40,… )(1,2,3,4,5,6,7,8,9,10,20,21,30,31,32,40,\dots) from smallest to largest.
The 1515-th smallest of them is 3232.

标签: AtCoder|abc321C

来源

AtCoder|abc321C