INUMBER  Interesting number
For the given number n find the minimal positive integer divisable by n, with the sum of digits equal to n.
Input
t – the number of test cases, then t test cases follow. (t <= 50)
Test case description:
n  integer such that 0 < n <= 1000
Output
For each test case output the required number (without leading zeros).
Example
Input: 2 1 10 Output: 1 190
hide comments
zarif_2002:
20190219 12:09:44
after 1 hours, AC in one go. 

darkknight21:
20180901 00:50:38
Really good one


sukhbir947:
20171219 23:31:49
Challenging one...!!


Sarthak Munshi:
20160905 22:15:57
Using STL gives WA while simulating using an array gives AC . Weird . Spent 2 full days on getting this passed . 

kartikay singh:
20160621 21:24:01
dp + bfs + backtracking = AC :B 

singhmanmeet40:
20160621 02:21:06
if using bfs don't use string to store no from starting


Navneet Kumar Srivastava:
20160408 07:10:46
Can someone explain why the output is 1 when input is 1?


shubham_goyal:
20160121 01:26:46
19 sums up to 10, but it is not divisible by 10. thats y.


kejriwal:
20160116 10:46:46
why is the answer of 2nd case 190.. ? 19 also sums upto 10 !! ? 

Rohit Agarwal:
20150907 22:06:56
Very challenging problem. Was fun to implement it. The hardest part was to print the number. Finally AC ;) :D

Added by:  Roman Sol 
Date:  20050113 
Time limit:  7s 
Source limit:  4096B 
Memory limit:  1536MB 
Cluster:  Cube (Intel G860) 
Languages:  All 
Resource:  XII team championship of St.Petersburg in programming 