TIMUS 1014. Product of Digits

来源:互联网 发布:iphone微信数据慢 编辑:程序博客网 时间:2024/06/06 16:58
题目如下:
Your task is to find the minimal positive integer number Q so that the product of digits of Q is exactly equal to N.

Input

The input contains the single integer number N (0 ≤ N ≤ 109).

Output

Your program should print to the output the only number Q. If such a number does not exist print −1.

Sample

inputoutput
10
25

 

 

 

题目比较简单,求各位数相乘等于给定数的最小数。 要注意给0的情况,按题意,结果不是0也不是-1,而是10,因为这个错了WE N次。

 

 

代码: