题目
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int t = sc.nextInt();
sc.nextLine();
while(t-- > 0) {
int n = sc.nextInt();
sc.nextLine();
int[] a = new int[n];
for(int i=0;i<n;i++)
a[i] = sc.nextInt();
int sum = 0;
int res = 0;
for(int i=0;i<n;i++) {
if(a[i] == 0) {
res++;
a[i] = 1;
}
sum+=a[i];
}
if(sum == 0) {
for(int i=0;i<n;i++) {
if(a[i] != -1) {
res++;
break;
}
}
}
System.out.println(res);
}
sc.close();
}
}
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int t = sc.nextInt();
sc.nextLine();
while(t!=0) {
int n = sc.nextInt();
sc.nextLine();
int[] a = new int[n];
for(int i=0;i<n;i++)
a[i] = sc.nextInt();
int sum = 0;
int num = 0;
for(int i=0;i<n;i++) {
if(a[i] == 0) {
num++;
a[i] = 1;
}
sum+=a[i];
}
if(sum == 0) {
for(int i=0;i<n;i++) {
if(a[i]!=-1) {
num++;
break;
}
}
}
System.out.println(num);
t--;
}
sc.close();
}
}