作者:yunjinqi 类别:
日期:2023-05-31 10:01:58
阅读:453 次 消耗积分:0 分
#include<stdio.h>
#include<math.h>
int main()
{
int N;
int maxString = 0;
int count = 0;
int num = 0;
int firstNum = 0;
if (scanf("%d",&N)!=EOF){
int i;
for(i = 2; i <= sqrt(N); i++)
{
num = N;
count = 0;
int j = i;
while(num%j == 0)
{
num = num/j;
j++;
count++;
}
if(count > maxString)
{
maxString = count;
firstNum = i;
}
}
if(maxString)
{
//判断是否存在连续数
printf("%d\n",maxString);
int i;
for(i = 0; i < maxString; i++)
{
printf("%d",firstNum + i);
if(i != maxString-1)
{
printf("*");
}
}
}
else
{
printf("1\n%d",N);
}
}else{
printf("input wrong");
}
return 0;
}