1.注意在2~(根号N+1)之间无解的话,输出N;
#include <cstdio>
#include <cstdlib>
#include <string.h>
#include <cmath>
#include <algorithm>
using namespace std;
int main()
{
int fac[100010];
int N;
scanf("%d",&N);
int temp=N;
int num=0;
int max=0,maxindex=0,minf=N,minindex=N;;
int sqr=sqrt(N*1.0);
int d;
for(int i=2;i<=sqr;i++)
{
d=i;
while(N%d==0)
{
if(d<minf)minf=d;
num++;
N=N/d;
if(num>max)
{
max=num;
maxindex=d;
}
d++;
}
num=0;
N=temp;
}
if(max==0)
{
printf("1\n");
}
else
{
printf("%d\n",max);
}
if(max<=1)
{
printf("%d",minf);
}
else if(max>1)
{
while(max>0)
{
printf("%d",maxindex-max+1);
max--;
if(max!=0)printf("*");
}
}
else if(max==0)
{
printf("%d",temp);
}
printf("\n");
system("pause");
return 0;
}