fork(7) download
  1. // iostream is too mainstream
  2. #include <cstdio>
  3. // bitch please
  4. #include <iostream>
  5. #include <vector>
  6. #include <set>
  7. #include <map>
  8. #include <string>
  9. #include <queue>
  10. #include <stack>
  11. #include <algorithm>
  12. #include <iomanip>
  13. #define dibs reserve
  14. #define OVER9000 1234567890
  15. #define patkan 9
  16. #define tisic 47
  17. #define soclose 10e-7
  18. #define ALL_THE(CAKE,LIE) for(auto LIE =CAKE.begin(); LIE != CAKE.end(); LIE++)
  19. #define chocolate win
  20. #define ff first
  21. #define ss second
  22. #define abs(x) ((x < 0)?-(x):(x))
  23. // mylittlepony
  24. using namespace std;
  25.  
  26. int main() {
  27. cin.sync_with_stdio(0);
  28. int N;
  29. cin >> N;
  30. map<int,int> M;
  31. vector<int> div;
  32. for(int i =1; i*i <= N; i++) if(N%i == 0) {
  33. div.push_back(i);
  34. if(N != i*i) div.push_back(N/i);}
  35. sort(div.begin(),div.end());
  36.  
  37. ALL_THE(div,it) {
  38. int x =(*it)/2+1;
  39. for(int i =2; i*i <= *it; i++)
  40. if((*it)%i == 0 && i < *it) x =min(x,M[i]*M[(*it)/i]);
  41. M[*it] =x;}
  42. cout << M[N] << "\n";
  43. return 0;}
  44.  
  45. // look at my code
  46. // my code is amazing
Success #stdin #stdout 0s 3436KB
stdin
999999999
stdout
50717536