显示代码纯文本
#include<bits/stdc++.h>
using namespace std;
long long n;
long long prime[20] = {0, 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53};
long long ans = 1000000000000000005;
void dfs(long long cur/*当前的数*/, long long cnt/*当前因数的个数*/, long long p/*第几个质数*/, long long k/*指数*/){
if (cur > ans) return;
if (cur < 0) return;
if (cnt > n) return;
if (cnt == n) {
ans = min(ans, cur);
return;
}
if (p > 10) return;//剪枝
for (long long i = 1; i <= k; i++) {//枚举指数
cur *= prime[p];
dfs(cur, cnt * (i + 1)/*约数个数计算定理*/, p + 1, i);
}
}
int main(){
freopen("CF27E.in","r",stdin);
freopen("CF27E.out","w",stdout);
cin>>n;
dfs(1,1,1,64);
cout<<ans;
return 0;
}