➤ Problem Link : 1300A. Non
✅ C++ Solution :
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
int main()
{
int t;
cin>>t;
while(t--)
{
int n,zc=0,nzc=0,x;
cin>>n;
ll sum=0;
for(int i=1;i<=n;i++)
{
cin>>x;
if(x!=0)
{
nzc++;
sum+=x;
}
else
zc++;
}
int ans=zc;
if(sum+zc==0)
ans++;
cout<<ans<<"\n";
}
}
Thank you for your patience reading. If you enjoyed this post, I’d be very grateful if you’d help it spread by emailing it to a friend, or sharing it on Whatsapp or Facebook.
😇Happy Learning!!
