显然质数越小越好,越小的质数次方越大越好,写个dfs爆搜一下
#include<bits/stdc++.h> using namespace std; typedef unsigned long long ll; const int N=4e5+10; const int inf=0x3f3f3f3f; int n; ll ans=1000000000000000001; int prime[]={2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53}; void dfs(ll now,int cur,int p,int cnt) { if(cnt>n) return; if(now>ans) return; if(cur>15) return; if(cnt==n){ ans=now;return; } for(int i=1;i<=p;++i) { dfs(now*=prime[cur],cur+1,i,cnt*(i+1)); } } int main(){ ios::sync_with_stdio(false); cin>>n; dfs(1ll,0,64,1); cout<<ans<<endl; }