显示代码纯文本
#include <bits/stdc++.h>
using namespace std;
#define ll __int128
#define ull unsigned long long
#define ld long double
#define pii pair<int,int>
#define fi first
#define se second
#define pb push_back
#define clr(f,n) memset(f,0,sizeof(int)*(n))
#define cpy(f,g,n) memcpy(f,g,sizeof(int)*(n))
const int N=1000+5;
const ll LIM=1e18;
int n,pri[]={0,2,3,5,7,11,13,17,19,23,29};
ll f[12][N];
int main(){
freopen ("CF27E.in","r",stdin);
freopen ("CF27E.out","w",stdout);
scanf("%d",&n);
for (int i=1;i<=n;i++)f[0][i]=LIM;
f[0][1]=1;
for (int i=1;i<=10;i++){
for (int j=1;j<=n;j++)f[i][j]=LIM;
for (int j=1;j<=n;j++){
ll p=f[i-1][j];
for (int k=0;j*(k+1)<=n&&p<=LIM;k++,p*=pri[i]){
f[i][j*(k+1)]=min(f[i][j*(k+1)],p);
}
}
}
printf("%lld\n",(long long)f[10][n]);
return 0;
}