Promi_38

cf 1300A

Jan 17th, 2021
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.32 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 s = 0, c = 0;
  16.         for(i = 0; i < n; i++)
  17.         {
  18.             if(a[i] == 0) c++;
  19.             s += a[i];
  20.         }
  21.         if(s + c == 0) c++;
  22.         printf("%d\n", c);
  23.     }
  24. }
Advertisement
Add Comment
Please, Sign In to add comment