1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
| #include<iostream> #include<cstdio> #define ll __int128 using namespace std; namespace Ehnaev{ inline ll read() { ll ret=0,f=1;char ch=getchar(); while(ch<48||ch>57) {if(ch==45) f=-f;ch=getchar();} while(ch>=48&&ch<=57) {ret=(ret<<3)+(ret<<1)+ch-48;ch=getchar();} return ret*f; } inline void write(ll x) { static char buf[22];static ll len=-1; if(x>=0) {do{buf[++len]=x%10+48;x/=10;}while(x);} else {putchar(45);do{buf[++len]=-(x%10)+48;x/=10;}while(x);} while(len>=0) putchar(buf[len--]); } }using Ehnaev::read;using Ehnaev::write;
ll n,ans=1e18+1; ll prime[20]={2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53};
inline void Dfs(ll x,ll step,ll lst,ll cnt) { if(cnt>n) return;if(x>ans) return;if(step>16) return; if(cnt==n) {ans=min(ans,x);return;} ll tmp=x; for(ll i=1;i<=lst;i++) { tmp*=prime[step];Dfs(tmp,step+1,i,cnt*(i+1)); } }
int main() {
n=read();
Dfs(1,0,64,1);
write(ans);
return 0; }
|