https://www.patest.cn/contests/gplt/L1-006
#include<cstdio> #include<cstdlib> #include<cmath> #include<queue> #include<string.h> #include<algorithm> using namespace std; const int maxn=10000007; const double INF=0x3f3f3f3f; int main() { long long n, i, j, cnt, minn=0, ans=0; scanf("%lld", &n); for(i=2; i*i<=n; i++) { cnt=1; for(j=i; cnt*j<=n; j++) { cnt*=j; if(n%cnt==0) { if(ans<j-i+1) { ans=j-i+1; minn=i; } } } } if(minn==0) { ans=1; minn=n; } printf("%d ", ans); for(i=minn; i<minn+ans; i++) { if(i>minn) printf("*"); printf("%d", i); } puts(""); return 0; }