crowulll

Untitled

Aug 17th, 2020
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.54 KB | None | 0 0
  1. #include<iostream>
  2. #include<vector>
  3. using namespace std;
  4. int t;
  5. int main(){
  6.     cin >> t;
  7.     while (t--){
  8.         int n; cin >> n;
  9.             int ones = 0; int odd = 0;
  10.             for (int j = 0; j < n; ++j){
  11.             string s; cin >> s;
  12.             if (s.length() % 2 == 1) odd++;
  13.             for (int i = 0; i < s.length(); ++i){
  14.                 if (s[i] == '1') ones++;
  15.             }
  16.         }
  17.         if (ones % 2 == 1 && odd > 0 || ones % 2 == 0)
  18.             cout << n << endl;
  19.             else cout << n - 1 << endl;
  20.  
  21.     }
  22. }
Advertisement
Add Comment
Please, Sign In to add comment