#P1605. Unique Number
Unique Number
题目描述
You are given a positive number . Find the smallest positive integer number that has the sum of digits equal to and all digits are distinct (unique).
输入格式
The first line contains a single positive integer — the number of test cases in the test. Then t test cases follow.
Each test case consists of a single integer number .
输出格式
Output t answers to the test cases:
- if a positive integer number with the sum of digits equal to and all digits are different exists, print the smallest such number;
- otherwise print -1.
样例
4
1
5
15
50
1
5
69
-1
提示
来源:codeforces
by 20王聪 录入