Submit | All submissions | Best solutions | Back to list |
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
Added by: | Roman Sol |
Date: | 2005-01-13 |
Time limit: | 7s |
Source limit: | 4096B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | C C++ 4.3.2 CPP C99 JAVA PYTHON PYTHON3 PY_NBC |
Resource: | XII team championship of St.-Petersburg in programming |