Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- #include <algorithm>
- #include <vector>
- using namespace std;
- bool pred(int a)
- {
- int cntOfChet = 0, cntOfNechet = 0;
- while(a){
- if((a % 10) % 2 == 0){
- cntOfChet++;
- }else{
- cntOfNechet++;
- }
- a /= 10;
- }
- if(cntOfChet == cntOfNechet){
- return true;
- }else{
- return false;
- }
- }
- int main()
- {
- vector<int> v;
- int x;
- while(cin >> x){
- v.push_back(x);
- }
- cout << count_if(v.begin(), v.end(), pred);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement