tien_noob

FINDNUM

Feb 9th, 2021 (edited)
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.75 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. int n,t[20];
  4. long long res=1e18;
  5. int a[] = {0,2,3,5,7,11,13,17,19,23,29,31};
  6. void xl()
  7. {
  8.     long long kq=1;
  9.         for (int i=1; i<=11; i++)
  10.         {
  11.             for (int j=1; j<=t[i]; j++)
  12.             {
  13.                 kq*=a[i];
  14.                 if (kq>res) return;
  15.             }
  16.         }
  17.     res=min(res,kq);
  18. }
  19. void sinh(int i,int n)
  20. {
  21.     for (int j=2; j<=n; j++)
  22.     {
  23.         if (n%j==0)
  24.         {
  25.             t[i]=j-1;
  26.             n/=j;
  27.             if (n==1) xl();
  28.             else sinh(i+1,n);
  29.             n*=j;
  30.             t[i]=0;
  31.         }
  32.     }
  33. }
  34. int main()
  35. {
  36.     cin >> n;
  37.     if (n==1)
  38.     {
  39.         cout << 1;
  40.         return 0;
  41.     }
  42.     sinh(1,n);
  43.     cout << res;
  44. }
Add Comment
Please, Sign In to add comment