定理:一个数约数个数=所有素因子的次数+1的乘积
然后得一个2000000000以内的数字不会有超过12个素因子
在一个因子数为n的集合中,这个集合中最小的数就是一个反质数。
所以我们只要找出小于n的数中因数个数最多的最小数。
#include <cstdio>
#include <algorithm>
using namespace std;
typedef long long LL;
const LL Inf = (unsigned)(-1) >> 1;
int prm[10]={2,3,5,7,11,13,17,19,23,29};
int num;
LL Ans,n;
void Dfs(int x,int y,LL z){
if(y > num) num = y,Ans = Inf;
if(y == num) Ans = min(Ans,z);
if(x >= 10) return;
for(int i=0;z<=n;z*=prm[x],i++) Dfs(x+1,y*(i+1),z);
}
int main(){
scanf("%lld",&n);Dfs(0,1,1);printf("%lld",Ans);return 0;
}