题目:
#include<stdio.h>
#include<math.h>
int main()
{
int n;
scanf("%d",&n);
int max=0,start=0,cnt=0;
for(int i=2;i<=sqrt(n);i++)//如果直接使用i<=n,那程序运行会时间超限
{
int temp=n;
cnt=0;
int j=i;
while(temp%j==0)//求出有连续几位因子
{
temp/=j;
cnt++;
j++;
}
if(cnt>max)
{
max=cnt;
start=i;//记录最开始连续的那一个因子的位置
}
}
if(max!=0)
{
printf("%d\n",max);
for(int i=0;i<max;i++)
{
printf("%d",start+i);//连续输出连续因子
if(i!=max-1)//输出格式控制
printf("*");
}
printf("\n");
}
else
printf("1\n%d\n",n);//只有一个因子,就是自己本身
return 0;
}