#abc321c. C - 321-like Searcher
C - 321-like Searcher
Score : points
问题描述
一个正整数 被称为321类数,当它满足以下条件时。这个定义与问题A中的定义相同。
- 的各位数字从上到下严格递减。
- 换句话说,若 有 位数字,则对于每一个满足 的整数 ,它满足以下条件:
- ( 的第 位数字) ( 的第 位数字)。
注意,所有一位的正整数都是321类数。
例如,、 和 都是321类数,但 、 和 不是。
找出第 小的321类数。
以上为通义千问 qwen-max 翻译,仅供参考。
Problem Statement
A positive integer 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 are strictly decreasing from top to bottom.
- In other words, if has digits, it satisfies the following for every integer such that :
- (the -th digit from the top of ) (the -th digit from the top of ).
Note that all one-digit positive integers are 321-like Numbers.
For example, , , and are 321-like Numbers, but , , and are not.
Find the -th smallest 321-like Number.
Constraints
- All input values are integers.
- At least 321-like Numbers exist.
Input
The input is given from Standard Input in the following format:
Output
Print the -th smallest 321-like Number as an integer.
Sample Input 1
15
Sample Output 1
32
The 321-like Numbers are from smallest to largest.
The -th smallest of them is .
Sample Input 2
321
Sample Output 2
9610
Sample Input 3
777
Sample Output 3
983210
update @ 2024/3/10 01:40:29