题解:
反素数。直接套板子就好了。
#include<bits/stdc++.h>
#define int unsigned long long
using namespace std;
const int inf=~0ULL;
int p[16] = {2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53};
int res,n;
void dfs(int dep,int tmp,int num)
{
if(num>n) return ;
if(num==n&&res>tmp){
res=tmp;
}
for(int i=1;i<64;i++){
if(res/p[dep]<tmp) break;
dfs(dep+1,tmp*=p[dep],num*(i+1));
}
}
signed main()
{
while(cin>>n){
res=inf;
dfs(0,1,1);
cout<<res<<'\n';
}
return 0;
}