Advertisement
Guest User

Untitled

a guest
Jan 28th, 2020
136
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.61 KB | None | 0 0
  1. #include <iostream>
  2. #include <cmath>
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7. int a, b, cnt = 0;
  8.  
  9. cin >> a >> b;
  10. int pp, ogl;
  11. double y;
  12. int z;
  13.  
  14. for (int x = 1; x * x <= b; ++x)
  15. {
  16. pp = x * x;
  17. if (pp >= a)
  18. {
  19. ogl = 0;
  20. while (pp)
  21. {
  22. ogl = ogl * 10 + pp % 10;
  23. pp /= 10;
  24. }
  25.  
  26. y = sqrt(ogl);
  27. z = y;
  28.  
  29. if (z == y) // daca ogl e patrat perfect
  30. cnt++;
  31. }
  32. }
  33.  
  34. cout << cnt;
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement