fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5. long long n;
  6. cin >> n;
  7.  
  8. int moves = 0;
  9.  
  10. // Count all prime factors
  11. for (long long p = 2; p * p <= n; p++) {
  12. while (n % p == 0) {
  13. moves++;
  14. n /= p;
  15. }
  16. }
  17.  
  18. // Don't forget the last prime!
  19. if (n > 1) moves++;
  20.  
  21. cout << moves << endl;
  22. return 0;
  23. }
  24.  
  25.  
Success #stdin #stdout 0.01s 5304KB
stdin
45
stdout
3