Advertisement
Guest User

Untitled

a guest
Jul 20th, 2018
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.71 KB | None | 0 0
  1. #include <iostream>
  2. #include <vector>
  3. #include <algorithm>
  4. #include <string>
  5. #include <iomanip>
  6. #include <cmath>
  7. #include <set>
  8. #include <map>
  9.  
  10. using namespace std;
  11.  
  12. const double pi = 3.141592653589793238;
  13. const double eps = 1e-10;
  14. const int inf = 1000000007;
  15.  
  16. int main()
  17. {
  18. ios::sync_with_stdio(false);
  19. cin.tie(0);
  20. cout.tie(0);
  21.  
  22. int n;
  23. cin >> n;
  24.  
  25. set<long long> m;
  26. m.insert(1);
  27. for (auto it = m.begin(); it != m.end(); ++it)
  28. {
  29. long long el = *it;
  30. if (el >= static_cast<long long>(1e18) / 2)
  31. continue;
  32. m.insert(el * 2);
  33. m.insert(el * 3);
  34. m.insert(el * 5);
  35. it = m.find(el);
  36. }
  37.  
  38. for (auto el : m)
  39. {
  40. --n;
  41. if (n == 0)
  42. cout << el << '\n';
  43. }
  44.  
  45. return 0;
  46. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement