#include<iostream>
#include<algorithm>
#include<cstring>
#include<cmath>
using namespace std;
int main(){
int n,i,j,t,length,maxlength=0,firsti;
cin>>n;
t=n;
int sqr=sqrt(n);
for(i=2;i<=sqr;i++)
{
n=t;
length=0;
if(n%i==0)
{
n=n/i;
j=i+1;
length=length+1;
while(n%j==0)
{
n=n/j;
length=length+1;
j=j+1;
}
if(length>maxlength)
{
firsti=i;
maxlength=length;
}
}
}
if(maxlength==0)
{
cout<<1<<endl;
cout<<t;
return 0;
}
cout<<maxlength<<endl;
for(i=0;i<maxlength;i++)
{
cout<<firsti;
if(i<maxlength-1)
{
cout<<"*";
}
firsti=firsti+1;
}
return 0;
}
pat甲1096 Consecutive Factors
猜你喜欢
转载自blog.csdn.net/chang_sheng1/article/details/104084478
今日推荐
周排行