-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGoodKid.java
More file actions
24 lines (24 loc) · 732 Bytes
/
Copy pathGoodKid.java
File metadata and controls
24 lines (24 loc) · 732 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import java.util.Arrays;
import java.util.Scanner;
public class GoodKid {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
if (scanner.hasNextInt()) {
int t = scanner.nextInt();
while (t-- > 0) {
int n = scanner.nextInt();
int[] a = new int[n];
for (int i = 0; i < n; i++) {
a[i] = scanner.nextInt();
}
Arrays.sort(a);
a[0]++;
long product = 1;
for (int i = 0; i < n; i++) {
product *= a[i];
}
System.out.println(product);
}
}
}
}