fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. long long n = 1000;
  5.  
  6. int main() {
  7. // your code goes here
  8. long long curr = 2LL, count = 0, ans = 2LL;
  9. while(count < n){
  10. int temp = curr;
  11. while(temp % 2LL == 0) temp = temp/2LL;
  12. while(temp % 3LL == 0) temp = temp/3LL;
  13. while(temp % 5LL == 0) temp = temp/5LL;
  14. if(temp == 1LL) count++;
  15. ans = curr;
  16. curr++;
  17. }
  18. cout << ans << endl;
  19. return 0;
  20. }
Success #stdin #stdout 1.08s 3460KB
stdin
Standard input is empty
stdout
51840000