-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path25A.java
More file actions
46 lines (43 loc) · 741 Bytes
/
25A.java
File metadata and controls
46 lines (43 loc) · 741 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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
import java.util.*;
import java.io.*;
public class Main{
public static void main(String[] args) throws Exception{
StringBuilder result = new StringBuilder();
Scanner input = new Scanner(System.in);
int loop = input.nextInt();
int even=0;
int odd =0;
int[] storage = new int[loop];
for(int i =0; i < loop;i++)
{
int temp =input.nextInt();
storage[i] = temp;
if(temp % 2 ==0)
even++;
else
odd++;
}
if(even > odd)
{
for(int i =0; i < loop;i++)
{
if(storage[i] % 2 !=0)
{
System.out.println(i+1);
return;
}
}
}
else
{
for(int i =0; i < loop;i++)
{
if(storage[i] % 2 ==0)
{
System.out.println(i+1);
return;
}
}
}
}
}