Promi_38

cf 1472B

Jan 6th, 2021
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.40 KB | None | 0 0
  1. #include<stdio.h>
  2.  
  3. int main()
  4. {
  5.     int t;
  6.     scanf("%d", &t);
  7.    
  8.     while(t--)
  9.     {
  10.         int n;
  11.         scanf("%d", &n);
  12.         int a[n], i;
  13.         for(i = 0; i < n; i++) scanf("%d", &a[i]);
  14.        
  15.         int c1 = 0, c2 = 0;
  16.         for(i = 0; i < n; i++)
  17.         {
  18.             if(a[i] == 1) c1++;
  19.             else if(a[i] == 2) c2++;
  20.         }
  21.         if(c1 % 2 != 0) printf("NO\n");
  22.         else if(c2 % 2 != 0 && c1 == 0) printf("NO\n");
  23.         else printf("YES\n");
  24.     }
  25. }
Advertisement
Add Comment
Please, Sign In to add comment