309657: CF1714C. Minimum Varied Number

Memory Limit:256 MB Time Limit:1 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

Minimum Varied Number

题意翻译

### 题目描述 找出数码和为 $s$ 的最小数字,使得其中的所有数字都是不同的(即所有数字都是唯一的)。 例如,如果 $s=20$ ,那么答案是 $389$。这是最小的数字,其中所有数字都不同,数字的总和为 $20$ ($3+8+9=20$)。 对于给定的 $s$ ,输出这个最小数字。 ### 输入格式 第一行包含整数 $t$ ( $1≤t≤45$) — 测试用例的数量。 每个测试用例由包含一行唯一整数:指定的 $s$ ($1≤s≤45$)。 ### 输出格式 输出 $t$ 个整数 ― 给定测试用例的答案。 ### 样例解释 对于第一个测试用例,$s=20$,最小数字为 $389$。 对于第二个测试用例,$s=8$,最小数字为 $8$($8=8$)。 对于第一个测试用例,$s=45$,最小数字为 $123456789$($1+2+3+4+5+6+7+8+9=45$)。 对于第一个测试用例,$s=10$,最小数字为 $19$($1+9=10$)。

题目描述

Find the minimum number with the given sum of digits $ s $ such that all digits in it are distinct (i.e. all digits are unique). For example, if $ s=20 $ , then the answer is $ 389 $ . This is the minimum number in which all digits are different and the sum of the digits is $ 20 $ ( $ 3+8+9=20 $ ). For the given $ s $ print the required number.

输入输出格式

输入格式


The first line contains an integer $ t $ ( $ 1 \le t \le 45 $ ) — the number of test cases. Each test case is specified by a line that contains the only integer $ s $ ( $ 1 \le s \le 45 $ ).

输出格式


Print $ t $ integers — the answers to the given test cases.

输入输出样例

输入样例 #1

4
20
8
45
10

输出样例 #1

389
8
123456789
19

Input

题意翻译

### 题目描述 找出数码和为 $s$ 的最小数字,使得其中的所有数字都是不同的(即所有数字都是唯一的)。 例如,如果 $s=20$ ,那么答案是 $389$。这是最小的数字,其中所有数字都不同,数字的总和为 $20$ ($3+8+9=20$)。 对于给定的 $s$ ,输出这个最小数字。 ### 输入格式 第一行包含整数 $t$ ( $1≤t≤45$) — 测试用例的数量。 每个测试用例由包含一行唯一整数:指定的 $s$ ($1≤s≤45$)。 ### 输出格式 输出 $t$ 个整数 ― 给定测试用例的答案。 ### 样例解释 对于第一个测试用例,$s=20$,最小数字为 $389$。 对于第二个测试用例,$s=8$,最小数字为 $8$($8=8$)。 对于第一个测试用例,$s=45$,最小数字为 $123456789$($1+2+3+4+5+6+7+8+9=45$)。 对于第一个测试用例,$s=10$,最小数字为 $19$($1+9=10$)。

Output

题目大意:给定一个数字s,找到数码和为s的最小数字,使得该数字中的所有数字都是不同的(即所有数字都是唯一的)。

输入数据格式:第一行包含一个整数t(1≤t≤45)——测试用例的数量。每个测试用例由一行唯一整数指定:指定的s(1≤s≤45)。

输出数据格式:输出t个整数——给定测试用例的答案。

例如,如果s=20,那么答案是389。这是最小的数字,其中所有数字都不同,数字的总和为20(3+8+9=20)。对于给定的s,输出这个最小数字。题目大意:给定一个数字s,找到数码和为s的最小数字,使得该数字中的所有数字都是不同的(即所有数字都是唯一的)。 输入数据格式:第一行包含一个整数t(1≤t≤45)——测试用例的数量。每个测试用例由一行唯一整数指定:指定的s(1≤s≤45)。 输出数据格式:输出t个整数——给定测试用例的答案。 例如,如果s=20,那么答案是389。这是最小的数字,其中所有数字都不同,数字的总和为20(3+8+9=20)。对于给定的s,输出这个最小数字。

加入题单

算法标签: