Advertisement
a53

nrdiv9

a53
Dec 30th, 2019
146
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.73 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. ifstream f("nrdiv9.in");
  4. ofstream g("nrdiv9.out");
  5. int main()
  6. {
  7. int n, p, q, nmax, k=0;
  8. f >> n;
  9. nmax=sqrt(n);
  10. int ciur[nmax];
  11. for (int i = 1; i <= nmax; i++)
  12. ciur[i] = i;
  13. for (int i = 2; i * i <= nmax; i++)
  14. if (ciur[i] == i)
  15. {
  16. for (int j = i * i; j <= nmax; j += i)
  17. if (ciur[j] == j)
  18. ciur[j] = i;
  19. }
  20. for (int i = 2; i <= nmax; i++)
  21. {
  22. p = ciur[i]; q = ciur[i / ciur[i]];
  23. if (p * q == i && q != 1 && p != q)
  24. k++;
  25. else
  26. if (ciur[i] == i)
  27. if (pow(i, 8) <= n)
  28. k++;
  29. }
  30. g << k;
  31. return 0;
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement