#P2999. inint
inint
ININT - Incrementing The Integer
题面翻译
从起点 开始,每次选择当前数的任意一位上加上去,例如,从 可以得到 或 ,若要用这种方法得到 ,AB两种方案都可以做到,A方案需要 次操作,B方案则只需要 次(这也是最少的操作次数)
$A. 1-2-4-8-16-17-18-19-20-22-24-28-36-39-48-56-62-68-76-83-91-100$
$B. 1-2-4-8-16-17-24-28-36-39-48-56-62-68-76-83-91-100$
C方案是另一种只需要 次操作的方法:
$C. 1-2-4-8-16-22-24-28-36-39-48-56-62-68-76-83-91-100$
现在,输入几个数,对于每个数,输出最小步骤 和解决方案数 。因为 可能相当大,所以应该输出 对 取模的值。
题目描述
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)
A. 1-2-4-8-16-17-18-19-20-22-24-28-36-39-48-56-62-68-76-83-91-100 B. 1-2-4-8-16-17-24-28-36-39-48-56-62-68-76-83-91-100
C is another 17 step solution for 100.
C. 1-2-4-8-16-22-24-28-36-39-48-56-62-68-76-83-91-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 ).
样例 #1
样例输入 #1
16
100
87
样例输出 #1
4 1
17 2
IMPOSSIBLE