fork download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. int prime[1000001];
  4. void sieve()
  5. {
  6. int i,j;
  7. for (i = 1;i <= 1000000;i++)
  8. prime[i] = i;
  9. for (i = 2;i <= trunc(sqrt(1000000));i++)
  10. if (prime[i] == i)
  11. for (j = i * i;j <= 1000000;j += i)
  12. if (prime[j] == j) prime[j] = i;
  13. }
  14. int pt(int n)
  15. {
  16. int i,j,d,res = 1;
  17. while (n != 1)
  18. {
  19. i = prime[n];
  20. d = 0;
  21. while (n % i == 0)
  22. {
  23. n /= i;
  24. d++;
  25. }
  26. res *= (1 + d);
  27. }
  28. return res;
  29. }
  30. int main()
  31. {
  32. int i,n,d = 0;
  33. cin >> n;
  34. sieve();
  35. for (i = 1;i <= trunc(sqrt(n));i++)
  36. if (n % i == 0)
  37. {
  38. if (pt(i) == 4) d++;
  39. if (i != n / i && pt(n / i) == 4) d++;
  40. }
  41. cout << d;
  42. return 0;
  43. }
  44.  
Success #stdin #stdout 0.01s 7416KB
stdin
Standard input is empty
stdout
1