https://codeforces.ml/contest/1454/problem/D
You are given an integer nn (n>1n>1).
Your task is to find a sequence of integers a1,a2,…,aka1,a2,…,ak such that:
- each aiai is strictly greater than 11;
- a1⋅a2⋅…⋅ak=na1⋅a2⋅…⋅ak=n (i. e. the product of this sequence is nn);
- ai+1ai+1 is divisible by aiai for each ii from 11 to k−1k−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.
Input
The first line of the input contains one integer tt (1≤t≤50001≤t≤5000) — the number of test cases. Then tt test cases follow.
The only line of the test case contains one integer nn (2≤n≤10102≤n≤1010).
It is guaranteed that the sum of nn does not exceed 10101010 (∑n≤1010∑n≤1010).
Output
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,…,aka1,a2,…,ak — 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.
Example
input
Copy
4 2 360 4999999937 4998207083
output
Copy
1 2 3 2 2 90 1 4999999937 1 4998207083
#include <bits/stdc++.h>
using namespace std;
#define ll long long
const int maxn=1e7+10;
const int mod=1e9+7;
ll t,n,cnt;
map<ll,ll>f;
ll b[maxn];
vector<ll>ans;
int main()
{
cin>>t;
cnt=0;
for(int i=2;i<=100000;i++)
{
if(!f[i])
{
cnt++;
b[cnt]=i;
for(int j=i*2;j<=100000;j+=i)
{
f[j]=i;
}
}
}
while(t--)
{
cin>>n;
ans.clear();
ll max1=1,id=-1;
for(int i=1;i<=cnt;i++)
{
if(n%b[i]==0)
{
ll s=0;
ll v=n;
while(v%b[i]==0)
{
v/=b[i];
s++;
}
if(max1<s)
{
max1=s;
id=b[i];
}
}
}
cout<<max1<<endl;
for(int i=1;i<=max1-1;i++)
{
cout<<id<<" ";
n/=id;
}
cout<<n<<endl;
}
return 0;
}

给定一个整数n,任务是找到一个整数序列a1, a2, ..., ak,使得序列元素都大于1且乘积等于n。序列的下一个元素必须能被前一个元素整除,同时序列长度k要最大化。对于所有满足条件的序列,输出任意一个。"
124801503,11717595,MYSQL查询实战:从基础到高级操作,"['数据库实践', 'SQL查询', 'MYSQL教程', '数据筛选', '数据操作']
776





