Advertisement
Guest User

rotciv

a guest
Feb 20th, 2020
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.64 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2.  
  3. using namespace std;
  4. int n;
  5. int nrasociat(int x)
  6. {
  7. int y = 0;
  8. while(x > 0)
  9. {
  10. if((x % 10) %2 == 0)
  11. y = y * 10 + x % 10;
  12. x /= 10;
  13. }
  14. return y;
  15. }
  16. int palindrom(int x)
  17. {
  18. int y, z = 0 ;
  19. y = x;
  20. while(y > 0)
  21. {
  22. z = z * 10 + y % 10;
  23. y/=10;
  24. }
  25. if(z == x) return 1;
  26. else return 0;
  27.  
  28. }
  29. void Read()
  30. {
  31. int i,x,cnt = 0;
  32. cin >> n;
  33. for(i = 1 ; i <= n ; i ++)
  34. {
  35. cin >> x;
  36. if(palindrom(nrasociat(x)) == 1) cnt ++;
  37. }
  38. cout << cnt;
  39. }
  40. int main()
  41. {
  42.  
  43. Read();
  44. return 0;
  45. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement