显示代码纯文本
#include<bits/stdc++.h>
using namespace std;
unsigned long long zs[20]={0,2,3,5,7,11,13,17,19,23,29,31,37,41,43,47},n,mi=0x3f3f3f3f3f3f3f3f;
void dfs(int x,long long nc,long long ys,long long mx)
{
if(x==16)
{
return;
}
if(nc>mi)
{
return;
}
if(ys>n)
{
return;
}
if(ys==n)
{
if(nc<mi)
{
mi=nc;
}
return;
}
for(int i=1;i<=mx;i++)
{
dfs(x+1,nc*pow(zs[x],i),ys*(i+1),n/(ys*(i+1)));
}
}
int main()
{
freopen("CF27E.in","r",stdin);
freopen("CF27E.out","w",stdout);
cin>>n;
dfs(1,1,1,n);
cout<<mi;
return 0;
}