fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. void solve() {
  5. int n;
  6. cin >> n;
  7.  
  8. int total_pangkat = 0;
  9. int faktor_prima = 0;
  10.  
  11. int temp = n;
  12. for(int i = 2;i * i<=temp;i++) {
  13. if(temp % i == 0) {
  14. faktor_prima++;
  15. while(temp % i == 0) {
  16. total_pangkat++;
  17. temp /= i;
  18. }
  19. }
  20. }
  21. if(temp > 1) {
  22. faktor_prima++;
  23. total_pangkat++;
  24. }
  25.  
  26. int ans = total_pangkat + faktor_prima - 1;
  27. cout << ans << endl;
  28. }
  29.  
  30. int main() {
  31. ios::sync_with_stdio(false);
  32. cin.tie(NULL);
  33. int t;
  34. cin >> t;
  35. while(t--) {
  36. solve();
  37. }
  38. }
Success #stdin #stdout 0s 5316KB
stdin
8
2
4
8
16
32
67
120
33
stdout
1
2
3
4
5
1
7
3