1454D.md (1672B)
1 Source: https://codeforces.com/problemset/problem/1454/D 2 3 D. Number into Sequence 4 5 time limit per test 6 7 3 seconds 8 9 memory limit per test 10 11 256 megabytes 12 13 input 14 15 standard input 16 17 output 18 19 standard output 20 21 You are given an integer $n$ ($n \gt 1$). 22 23 Your task is to find a sequence of integers $a_1, a_2, \ldots, a_k$ such that: 24 25 * each $a_i$ is strictly greater than $1$; 26 * $a_1 \cdot a_2 \cdot \ldots \cdot a_k = n$ (i. e. the product of this sequence is $n$); 27 * $a_{i + 1}$ is divisible by $a_i$ for each $i$ from $1$ to $k-1$; 28 * $k$ is the maximum possible (i. e. the length of this sequence is the maximum possible). 29 30 If there are several such sequences, any of them is acceptable. It can be proven that at least one valid sequence always exists for any integer $n \gt 1$. 31 32 You have to answer $t$ independent test cases. 33 34 Input 35 36 The first line of the input contains one integer $t$ ($1 \le t \le 5000$) — the number of test cases. Then $t$ test cases follow. 37 38 The only line of the test case contains one integer $n$ ($2 \le n \le 10^{10}$). 39 40 It is guaranteed that the sum of $n$ does not exceed $10^{10}$ ($\sum n \le 10^{10}$). 41 42 Output 43 44 For each test case, print the answer: in the first line, print one positive integer $k$ — the maximum possible length of $a$. In the second line, print $k$ integers $a_1, a_2, \ldots, a_k$ — the sequence of length $k$ satisfying the conditions from the problem statement. 45 46 If there are several answers, you can print any. It can be proven that at least one valid sequence always exists for any integer $n \gt 1$. 47 48 Example 49 50 Input 51 52 ``` 53 4 54 2 55 360 56 4999999937 57 4998207083 58 ``` 59 60 Output 61 62 ``` 63 1 64 2 65 3 66 2 2 90 67 1 68 4999999937 69 1 70 4998207083 71 ```