-
Notifications
You must be signed in to change notification settings - Fork 15
/
p221.java
31 lines (28 loc) · 859 Bytes
/
p221.java
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
import java.util.Scanner;
public class p221 {
public static void main(String[] args) {
final Scanner s = new Scanner(System.in);
int[] queue;
boolean flag, valid;
int cases = s.nextInt(), n, pos;
while (cases-- != 0) {
n = s.nextInt();
queue = new int[n];
for (int i = 0; i < n; i++)
queue[i] = s.nextInt();
flag = false; valid = true;
pos = 0;
for (int num : queue) {
if (flag && num % 2 == 0) {
valid = false;
break;
}
else if (num % 2 != 0) {
pos++;
}
flag = flag || num % 2 != 0;
}
System.out.println( valid ? "SI " + (n - pos) : "NO" );
}
}
}