题意:找出起始值最小的长度最长的连续因子 。
#include<iostream>
#include<cmath>
using namespace std;
int main() {
int n;
cin>>n;
int maxlen=0,first=0;
for(int i=2; i<(int)sqrt(n)+1; ++i) {
int temp=i;
int t=n;
while(t%temp==0) {
t/=temp;
temp++;
}
if(temp-i>maxlen) {
maxlen=temp-i;
first=i;
}
}
if(first) {
cout<<maxlen<<endl;
cout<<first;
for(int i=first+1; i<maxlen+first; ++i)
cout<<"*"<<i;
} else {
cout<<1<<endl;
cout<<n;
}
return 0;
}
















