Advertisement
ySiriuS17

14 alg

Nov 12th, 2019
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.21 KB | None | 0 0
  1. ///14
  2. #include <iostream>
  3. #include <algorithm>
  4. #include <vector>
  5. #include <cmath>
  6. using namespace std;
  7. /*
  8. 123321 162 32 12321 959 46654
  9. */
  10. bool sim(int a){
  11. a=fabs(a);
  12. if (a<10) return 0;
  13. vector <int> z1;
  14. while (a){
  15. z1.push_back(a%10);
  16. a/=10;
  17. }
  18. /* for (int i=0; i<z1.size(); i++)
  19. cout<<z1[i]<<' ';
  20. cout<<endl;*/
  21. vector <int> z2(z1.size());
  22. reverse_copy(z1.begin(),z1.end(),z2.begin());
  23. /* for (int i=0; i<z2.size(); i++)
  24. cout<<z2[i]<<' ';
  25. cout<<endl;*/
  26. return equal(z1.begin(),z1.end(),z2.begin());
  27. }
  28. int main()
  29. {
  30. vector <int> v;
  31. int x;
  32. while (cin>>x)
  33. v.push_back(x);
  34. cout<<"Takih chisel = "<<count_if(v.begin(),v.end(),sim);
  35.  
  36. return 0;
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement