-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path1300A-Non-zero.cpp
58 lines (49 loc) · 1.46 KB
/
1300A-Non-zero.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
//Definition Section
//--------------------------------------------------------------
#define fl(i,x,y) for(int i=x; i<y; i++)
#define flc(i,x,y,z) for(int i=x; i<y; i+=z)
#define nl cout<<endl
#define vsort(v) sort(v.begin(), v.end());
#define vsortg(v) sort(v.begin(), v.end(), greater<int>());
#define getIntoVc(v,n) { while(n--) {long long yyy; cin>>yyy; v.push_back(yyy);}}
#define all(x) x.begin(),x.end()
#define pb push_back
#define printvc(v) for(int i=0; i<v.size(); i++) cout<<v[i]<<" ";
#define strTOint(s,n) {stringstream sst; sst<<s; sst>>n;}
#define intTOstr(n,s) {stringstream sst; sst<<n; sst>>s;}
#define ff first
#define ss second
#define DouraMama {ios::sync_with_stdio(false); cin.tie(NULL);}
#define prefixSum(v,prefix) {long long sum=0; for(int i=0; i<v.size(); i++) {sum+=v[i];prefix.push_back(sum);}}
//--------------------------------------------------------------
int main()
{ DouraMama
ll n,m,t,i,j,k,x,y,z,a,b,c,cnt=0,ans=0;
bool flag=false;
string s,s1,s2,s3;
cin>>t;
while(t--) {
ll res=0;
vector<ll> v;
cnt=0;ans=0;
cin>>n;
while(n--) {
cin>>k;
ans+=k;
if(k==0) cnt++;
v.pb(k);
}
if(ans==0 || cnt!=0) {
if(cnt>0) {
res+=cnt;
ans+=cnt;
}
if(ans==0) res++;
}
cout<<res<<endl;
}
//cout<<endl; main();
}