
Product of Digits
|
All submissions for this problem are available.
The chef may be losing his mind. He has demanded you solve the following task:
given an integer P, find the smallest positive integer whose product of digits, modulo 1000000007, is P.
You can't imagine what this has to do with cooking, but you'd better do what he says or you won't get to sample his culinary delights.
Input:
Input will begin with a positive integer T<=15, the number of test cases.
T lines follow, each containing an integer P between 0 and 1000000006, inclusive.
Output:
For each test case, print on a single line the smallest positive integer whose product of digits, modulo 1000000007, is P.
It is guaranteed that such an integer exists with fewer than 700 digits.
Sample input:
4 16 486 220703118 0
Sample output:
28 699 5555555555555 10
Author: | pieguy |
Tester: | Maksflow |
Editorial | http://discuss.codechef.com/problems/DIGITS |
Tags | cook03, hard, pieguy |
Date Added: | 25-09-2010 |
Time Limit: | 2.48684 sec |
Source Limit: | 50000 Bytes |
Languages: | C, CPP14, JAVA, PYTH, PYTH 3.6, PYPY, CS2, PAS fpc, PAS gpc, RUBY, PHP, GO, NODEJS, HASK, rust, SCALA, swift, D, PERL, FORT, WSPC, ADA, CAML, ICK, BF, ASM, CLPS, PRLG, ICON, SCM qobi, PIKE, ST, NICE, LUA, BASH, NEM, LISP sbcl, LISP clisp, SCM guile, JS, ERL, kotlin, PERL6, TEXT, SCM chicken, PYP3, CLOJ, COB, FS |
Comments
- Please login at the top to post a comment.
SUCCESSFUL SUBMISSIONS
Fetching successful submissions
HELP
If you are still having problems, see a sample solution here. |
