ININT - Incrementing The Integer
Starting from the number '1', every time you can choose a digit from the current number and add it to the number itself. 23, for example, could be changed into 25 or 26. To get 100, using the above scheme, paths A and B are both possible. A requires 21 steps, but B needs only 17 (which is also the minimum)
C is another 17 step solution for 100.
Now, you are given several numbers, for each number, print the minimum steps S and number of solutions T. As T could be quite large, you should print T%1000000007 instead.
Each line of input contains a integer K as a test case. Input ends with End Of File.
For each test case print the minimum steps and solutions in a single line. If it's impossible to get the number, print "IMPOSSIBLE" instead. ( without the quotes ).
Input: 16 100 87 Output: 4 1 17 2 IMPOSSIBLE
Constraints and Limits
Number of test cases ≤ 100, 1 ≤ K ≤ 10^9.
In my experience, problems where the fastest C solution exceeds 0.04s are not solvable in Python unless the TL is relaxed (eg. this one probably isn't).
Does python even run in the provided time limit?
what is the limit K