10858 -
#include <iostream>
#include <sstream>
#include <vector>
#include <algorithm>
#define forr(i,b) for(int i=0;i<b;i++)
using namespace std;
#define NN 2000000
stringstream ss;
int k;
vector<string> sd;
void rep(int n, int a, string s)
{
for(int i=a;i*i<=n;i++)
{
if(n%i==0)
{
stringstream ss(s);
ss<<s<<i<<" ";
rep(n/i,i,ss.str());
}
}
stringstream ss(s);
ss<<s<<n<<endl;
sd.push_back(ss.str());
k++;
return;
}
int main(int argc, char *argv[])
{
int N;
k=0;
while(cin>>N)
{
if(N==0)break;
k=0;
sd.clear();
rep(N,2,"");
cout<<k-1<<endl;
forr(i,k-1)cout<<sd[i];
}
return 0;
}
No comments:
Post a Comment