Code:
#include<cstdio> #include<algorithm> using namespace std; typedef long long ll; int prime[]={0,2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,51,53}; ll n, maxn; int cur; void dfs(int dep,ll m,int t,int p){ //上一个指数 if(dep==12){ if(t>=cur){ if(t>cur) maxn=m, cur=t; else if(m<maxn) maxn=m; } return; } ll cnt=1; for(int i=0;i<=p;++i){ dfs(dep+1,m*cnt,t*(i+1),i); cnt*=prime[dep]; if(m*cnt>n) break; } } int main(){ //freopen("input.in","r",stdin); scanf("%lld",&n); dfs(1,1,1,30); printf("%lld",maxn); return 0; }
原文地址:https://www.cnblogs.com/guangheli/p/9891053.html
时间: 2024-10-27 05:41:15