CF1454D.Number into Sequence
普及/提高-
通过率:0%
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
You are given an integer n ( n>1 ).
Your task is to find a sequence of integers a1,a2,…,ak such that:
- each ai is strictly greater than 1 ;
- a1⋅a2⋅…⋅ak=n (i. e. the product of this sequence is n );
- ai+1 is divisible by ai for each i from 1 to k−1 ;
- k is the maximum possible (i. e. the length of this sequence is the maximum possible).
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>1 .
You have to answer t independent test cases.
输入格式
The first line of the input contains one integer t ( 1≤t≤5000 ) — the number of test cases. Then t test cases follow.
The only line of the test case contains one integer n ( 2≤n≤1010 ).
It is guaranteed that the sum of n does not exceed 1010 ( ∑n≤1010 ).
输出格式
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 a1,a2,…,ak — the sequence of length k satisfying the conditions from the problem statement.
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>1 .
输入输出样例
输入#1
4 2 360 4999999937 4998207083
输出#1
1 2 3 2 2 90 1 4999999937 1 4998207083