-
Notifications
You must be signed in to change notification settings - Fork 55
/
Copy path25A. IQ test.cpp
42 lines (38 loc) · 847 Bytes
/
25A. IQ test.cpp
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
//============================================================================
//problem link:http://codeforces.com/problemset/problem/25/A
// Name : .cpp
// Author : mohand sakr
// Version :
// Copyright : use it under your responsibility
// Description : Hello World in C++, Ansi-style
//status:accepted
//============================================================================
#include <iostream>
#include<algorithm>
using namespace std;
int main() {
int n;
cin >> n;
int arr[n];
for (int i = 0; i < n; i++) {
cin >> arr[i];
arr[i] = arr[i] % 2;
}
int one = count(arr, arr + n, 1);
if (one > n - one) {
for (int i = 0; i < n; i++) {
if (!arr[i]) {
cout << i + 1;
break;
}
}
} else {
for (int i = 0; i < n; i++) {
if (arr[i]) {
cout << i + 1;
break;
}
}
}
return 0;
}