Product of digits
Very easy
Execution time limit is 1 second
Runtime memory usage limit is 64 megabytes
Find the smallest and largest natural numbers such that the product of their digits equals the given natural number M
. If no such numbers exist, output -1 -1. Note that the digits 0 and 1 cannot be used in forming these numbers.
The input consists of a single integer M (2 ≤ M ≤ 10^3). The output should be two integers in non-decreasing order.
Examples
Input #1
Answer #1
Submissions 1K
Acceptance rate 32%