Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- int n,t[20];
- long long res=1e18;
- int a[] = {0,2,3,5,7,11,13,17,19,23,29,31};
- void xl()
- {
- long long kq=1;
- for (int i=1; i<=11; i++)
- {
- for (int j=1; j<=t[i]; j++)
- {
- kq*=a[i];
- if (kq>res) return;
- }
- }
- res=min(res,kq);
- }
- void sinh(int i,int n)
- {
- for (int j=2; j<=n; j++)
- {
- if (n%j==0)
- {
- t[i]=j-1;
- n/=j;
- if (n==1) xl();
- else sinh(i+1,n);
- n*=j;
- t[i]=0;
- }
- }
- }
- int main()
- {
- cin >> n;
- if (n==1)
- {
- cout << 1;
- return 0;
- }
- sinh(1,n);
- cout << res;
- }
Add Comment
Please, Sign In to add comment