Codeforces Beta Round #25 (Div. 2) -- A. IQ test,

Source: Internet
Author: User

Codeforces Beta Round #25 (Div. 2) -- A. IQ test,


IQ test
Time limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard output

Bob is preparing to pass IQ test. The most frequent task in this test is to find out which one of the givenNNumbers differs from the others. Bob observed that one number usually differs from the others in evenness. Help Bob-to check his answers, he needs a program that among the givenNNumbers finds one that is different in evenness.

Input

The first line contains integerN(3 cores ≤ CoresNLimit ≤ limit 100)-amount of numbers in the task. The second line containsNSpace-separated natural numbers, not exceeding 100. It is guaranteed, that exactly one of these numbers differs from the others in evenness.

Output

Output index of number that differs from the others in evenness. Numbers are numbered from 1 in the input order.

Sample test (s) input
52 4 7 8 10
Output
3
Input
41 2 1 1
Output
2




Solution Report: Water question... Here is a number of columns. Only one of these columns has a parity different from other columns. Scan it directly, record the last odd and even positions, and record the odd and even numbers.







AC code:

# Include <stdio. h> # include <string. h> # include <iostream> # include <algorithm> # include <vector> # include <queue> # include <set> # include <map> # include <string> # include <math. h> # include <stdlib. h> # include <time. h> using namespace std; # define INF 0x7fffffint a [105]; int main () {# ifdef sxk freopen ("in.txt", "r", stdin ); # endif int n; while (scanf ("% d", & n )! = EOF) {int ans1 = 0, ans2 = 0, x, y; for (int I = 0; I <n; I ++) {cin> a [I]; if (a [I] & 1) {ans1 ++; x = I + 1 ;}else {ans2 ++; y = I + 1 ;}}if (ans1> ans2) cout <y <endl; // The condition can be changed to ans1 = 1 else cout <x <endl;} return 0 ;}







Round The Bend lyrics

Song name: Round The Bend
Artist: The Beta Band
Album: The Beta Band

Round The Bend
Beck
Sea Change
We don't have to worry
Life goes where it does
Faster than a bullet
From an empty gun
Turn yourself over
Loose change we cocould spend
Grinding down diamonds
Round, round, round the bend
Round, round, round the bend
People pushing harder
Up against themselves
Make their daggers sharper
Than their faces tell
Babe, its your time now
Loose change we cocould spend
Where we are going
Round, round, round the bend
Round, round, round the bend

Music.baidu.com/song/2766592


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.