看了红博大佬的博客。。。
做这个题还是我太慌张。。。 上来想也不想就整了个质因数分解的板子。
赛后才知道就是暴力。。。当然是有技巧的暴力
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <vector>
#define inf 0x3f3f3f3f
#define ms(x) memset(x, 0, sizeof(x))
#define ll long long
using namespace std;
const int N = 100007;
vector<ll>box[N];
int top = 0;
bool solve(ll n)
{
ll tn = n;
while(tn%2==0)
{
tn/=2;
}
if(tn==1) return false;
box[top].push_back(n);
for(ll i=2;i*i*i<=n;i++)
{
if(n%i==0)
{
ll tmp = n;
vector<ll> o ;
while(tmp%i==0)
{
tmp/=i;
o.push_back(i);
}
while(tmp%(i+1)==0)
{
tmp/=(i+1);
o.push_back(i+1);
}
if(tmp==1)
{
box[++top] = o;
}
}
}
ll ti = sqrt(n);
if(ti*ti == n)
{
box[++top].push_back(ti);
box[top].push_back(ti);
}
else if(ti*(ti+1)==n)
{
box[++top].push_back(ti);
box[top].push_back(ti+1);
}
else if((ti-1)*(ti)==n)
{
box[++top].push_back(ti-1);
box[top].push_back(ti);
}
return true;
}
int main()
{
ll n;
freopen("little.in","r",stdin);
freopen("little.out","w",stdout);
scanf("%lld", &n);
if(!solve(n))
{
puts("-1");
return 0;
}
printf("%d\n", top+1);
for(int i=0;i<=top;i++)
{
printf("%d",box[i].size());
for(int j=0;j<box[i].size();j++)
{
printf(" %lld", box[i][j]);
}
printf("\n");
}
return 0;
}