题目范围 是2^31 所以找最长的连续因子 1*...*13 > 2^31,所以最长的连续因子最多12个暴力搜就好了
#include"bits/stdc++.h"
using namespace std;
int n,q;
int main()
{
cin >> n;
q =sqrt(n);
for(int len=12;len>=1;len--) //最多个数
{
for(int i = 2 ; i <= q ; i ++) // 连续的因子不会超过数的平方根
{
long long ans = 1; //从2开始找最长的
for(int j=i;j-i<len;j++)
ans*=j;
if(n%ans == 0){ //因为从2开始找肯定是最长的 所以一个个枚举过去
cout << len << endl << i;
for(int j=i+1;j-i<len;j++){
cout << '*' << j;
}
return 0;
}
}
}
cout << 1 << endl << n << endl;
return 0;
}