-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathIQTest.java
More file actions
31 lines (26 loc) · 893 Bytes
/
IQTest.java
File metadata and controls
31 lines (26 loc) · 893 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
25
26
27
28
29
30
31
/**
* Created by MalhotR1 on 05/20/2018.
*/
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class IQTest {
public static void main(String[] args) throws IOException {
try (BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {
int N = Integer.parseInt(br.readLine().trim());
int[] arr = new int[N];
String[] in = br.readLine().trim().split(" ");
int to = 0;
int te = 0;
int lo = -1;
int le = -1;
for (int i = 0; i < in.length; i++) {
arr[i] = Integer.parseInt(in[i]);
if ((arr[i] & 1) == 0) { te++; le = i+1;}
else { to++; lo = i+1; }
}
if (to > te) System.out.println(le);
else System.out.println(lo);
}
}
}