CF1454D.Number into Sequence

普及/提高-

通过率:0%

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

You are given an integer nn ( n>1n > 1 ).

Your task is to find a sequence of integers a1,a2,,aka_1, a_2, \ldots, a_k such that:

  • each aia_i is strictly greater than 11 ;
  • a1a2ak=na_1 \cdot a_2 \cdot \ldots \cdot a_k = n (i. e. the product of this sequence is nn );
  • ai+1a_{i + 1} is divisible by aia_i for each ii from 11 to k1k-1 ;
  • kk 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>1n > 1 .

You have to answer tt independent test cases.

输入格式

The first line of the input contains one integer tt ( 1t50001 \le t \le 5000 ) — the number of test cases. Then tt test cases follow.

The only line of the test case contains one integer nn ( 2n10102 \le n \le 10^{10} ).

It is guaranteed that the sum of nn does not exceed 101010^{10} ( n1010\sum n \le 10^{10} ).

输出格式

For each test case, print the answer: in the first line, print one positive integer kk — the maximum possible length of aa . In the second line, print kk integers a1,a2,,aka_1, a_2, \ldots, a_k — the sequence of length kk 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>1n > 1 .

输入输出样例

  • 输入#1

    4
    2
    360
    4999999937
    4998207083

    输出#1

    1
    2 
    3
    2 2 90 
    1
    4999999937 
    1
    4998207083
首页