显示代码纯文本
#include<bits/stdc++.h>
using namespace std;
typedef unsigned long long ull;
int prime[16]={0,2,3,5,7,11,13,17,19,23,29,31,33,37,41,43};
ull ans=0x3ffffffffffffffff,M=1e18;
ull n;
void dfs(ull zs,ull cj,ull gs,ull limit)
{
if(zs > 15) return;
if(cj > ans) return;
if(gs > n) return;
if(cj > M) return;
if(gs == n)
{
ans=min(cj,ans);
return;
}
for(ull i = 1;i <= limit; ++i)
{
dfs(zs+1,cj*=prime[zs],gs*(i+1),i);
}
}
int main()
{
freopen("CF27E.in","r",stdin);
freopen("CF27E.out","w",stdin);
cin>>n;
dfs(1,1,1,64);
cout<<ans;
}