All submissions for this problem are available.
Find the smallest number such that the sum of it's digits is N and it is divisible by 10N.If no such number exists, print -1
The first line contains, T, denoting the number of test cases.
Each test case consist of a single integer N.
For each test case, print the required answer.
1 ≤ T ≤ 100 0 ≤ N ≤ 10000
- Subtask #1 (5 points) : 0 ≤ N ≤ 6
- Subtask #2 (25 points) : 0 ≤ N ≤ 18
- Subtask #3 (70 points) : Original Constraints
|Tags||easy, greedy, likecs, likecs|
|Time Limit:||1 sec|
|Source Limit:||50000 Bytes|
|Languages:||C, CPP14, JAVA, PYTH, PYTH 3.6, PYPY, CS2, PAS fpc, PAS gpc, RUBY, PHP, GO, NODEJS, HASK, rust, SCALA, swift, D, PERL, FORT, WSPC, ADA, CAML, ICK, BF, ASM, CLPS, PRLG, ICON, SCM qobi, PIKE, ST, NICE, LUA, BASH, NEM, LISP sbcl, LISP clisp, SCM guile, JS, ERL, TCL, kotlin, PERL6, TEXT, SCM chicken, CLOJ, COB, FS|
Fetching successful submissions