测评会员优惠活动进行中 · 开通 VIP,有效期内测评不限次 VIP 优惠中 · 测评不限次 立即查看

A15355. Minimum Varied Number

编程题 普及/提高-

题目描述

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
上一题 去做题 下一题