import java.util.Scanner;
public class Ques15 {
static int count = 0;
public static void main(String[] args) {
Scanner obj = new Scanner(System.in);
int T = obj.nextInt();
for (int i = 0; i < T; i++) {
int N = obj.nextInt();
int[] arr = new int[N];
for (int j = 0; j < arr.length; j++) {
arr[j] = obj.nextInt();
}
SubsetSumZero(arr, 0, 0);
if (count > 1) // because there will be one universal empty set whose sum will be coming to zero
{
System.out.println("Yes");
} else {
System.out.println("No");
}
}
}
public static void SubsetSumZero(int[] arr, int sp, int ans) {
if (sp == arr.length) {
if (ans == 0) {
count++;
}
return;
}
SubsetSumZero(arr, sp + 1, ans);
SubsetSumZero(arr, sp + 1, ans + arr[sp]);
}
}
Error is given below
Output : Compile_error
Compiling failed with exitcode 1, compiler output:
prog.cpp:1:1: error: ‘import’ does not name a type; did you mean ‘short’?
import java.util.Scanner;
^~~~~~
short
prog.cpp:3:1: error: expected unqualified-id before ‘public’
public class Ques15 {
^~~~~~