#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
#include <cstring>
#include <vector>
#include <queue>
#include <map>
#include <set>
using namespace std;
bool isp(int a)
{
if(a==1)
return 0;
for(int i=2;i<=(int)sqrt(a);i++)
{
if(a%i==0)
return 0;
}
return 1;
}
int main()
{
// freopen("in.txt","r" ,stdin);
long long maxlen=0,first;
long long N;
scanf("%lld",&N);
if(isp(N)==1)
{
printf("1\n");
printf("%lld",N);
return 0;
}
long long sqrtt=(long long)sqrt(N);
for(int i=2;i<=sqrtt;i++)
{
// 头是2 i
long long t=i;
long long len=0;
long long pro=i;
while(N%pro==0)
{
len++;
if(len>maxlen)
{
maxlen=len;
first=i;
}
t++;
pro=pro*t;
}
}
printf("%lld\n",maxlen);
for(int i=0;i<maxlen;i++)
{
printf("%lld",first+i);
if(i!=maxlen-1)
printf("*");
}
return 0;
}
1096. Consecutive Factors (20)
最新推荐文章于 2021-10-06 21:25:59 发布
本文介绍了一个使用C++编写的程序,该程序能够检测一个数是否为素数,并找出以给定数值为基础的最大长度的素数序列。通过分解输入数字并寻找其素数因子的模式来实现这一目标。

540

被折叠的 条评论
为什么被折叠?



