문제1753--Products of digits

1753: Products of digits

실행시간 제한: 1 Sec  메모리사용 제한: 128 MB
제출: 65  통과: 28
[제출] [채점기록] [묻고답하기]

문제 설명

You are given an integer N. Find the smallest positive integer X such that the product of its digits (in decimal notation) is equal to N. Print the number of digits in X, or print -1 if such a number does not exist.

 

입력 설명

The input consists of T test cases. The number of test cases T is given in the first line of the input.

 

The one and only line of each test case contains a single integer N(0 ≤ N ≤ 109).
 

출력 설명

Print exactly one line for each test case.

 

입력 예시 Copy

6
1
10
26
100
2520
864

출력 예시 Copy

1
2
-1
3
4
4

출처/분류