其他分享
首页 > 其他分享> > 1096 Consecutive Factors

1096 Consecutive Factors

作者:互联网

 

 

#include <bits/stdc++.h>
# define LL long long
using namespace std;

int main(){
    int N;
    cin>>N;
    int mx=0;
    int idx=0;
    for(int i=2;i<=sqrt(N)+1;i++){
        int tmp=1;
        int j;
        for(j=i;j<=sqrt(N)+1;j++){
            tmp*=j;
            if(N%tmp!=0) break;
        }
        if(j-i>mx){
            mx=j-i;
            idx=i;
        }
    }
    if(mx==0){
        printf("1\n%d", N);
        return 0;
    }
    printf("%d\n",mx);
    for(int i=idx;i<=mx+idx-1;i++){
        if(i>idx) printf("*");
        printf("%d", i);
    }
    return 0;
}

 

标签:1096,return,idx,Factors,int,long,printf,Consecutive,mx
来源: https://www.cnblogs.com/FEIIEF/p/12641855.html