#P2821. 变幻数
变幻数
Description
Given a positive decimal integer , its recursive "transform number" is defined as follows:
-
If has more than 1 digit (ignoring leading zeros), multiply all its digits, and let the product be . Call a "sub-transform number" of , and call a "parent transform number" of . To compute the "transform number" of a number means to keep taking its sub-transform number recursively. That is, computing the transform number of is the same as computing the transform number of .
-
If has exactly one digit, then its transform number is itself. For example, the process for the transform number of is: $679 \to 378(6 \times 7 \times 9) \to 168(3 \times 7 \times 8) \to 48(1 \times 6 \times 8) \to 32(4 \times 8) \to 6(2 \times 3)$, so the transform number of is .
Now, given a sub-transform number , what is the smallest parent transform number of ? For example, when , the parent transform number can be or , but the smallest is .
Input Format
A sub-transform number (number of digits ).
Output Format
The smallest parent transform number of . If no parent transform number exists, output There is no such number!.
48
68
Hint
Translated by ChatGPT 5
京公网安备 11011102002149号