最新文章专题视频专题问答1问答10问答100问答1000问答2000关键字专题1关键字专题50关键字专题500关键字专题1500TAG最新视频文章推荐1 推荐3 推荐5 推荐7 推荐9 推荐11 推荐13 推荐15 推荐17 推荐19 推荐21 推荐23 推荐25 推荐27 推荐29 推荐31 推荐33 推荐35 推荐37视频文章20视频文章30视频文章40视频文章50视频文章60 视频文章70视频文章80视频文章90视频文章100视频文章120视频文章140 视频2关键字专题关键字专题tag2tag3文章专题文章专题2文章索引1文章索引2文章索引3文章索引4文章索引5123456789101112131415文章专题3
当前位置: 首页 - 科技 - 知识百科 - 正文

CodeforcesBetaRound#25(Div.2)A.IQtest_html/css

来源:动视网 责编:小采 时间:2020-11-27 15:57:05
文档

CodeforcesBetaRound#25(Div.2)A.IQtest_html/css

CodeforcesBetaRound#25(Div.2)A.IQtest_html/css_WEB-ITnose:IQ test time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Bob is preparing to pass IQ test. The most frequent task in this test is to find out which one of the
推荐度:
导读CodeforcesBetaRound#25(Div.2)A.IQtest_html/css_WEB-ITnose:IQ test time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Bob is preparing to pass IQ test. The most frequent task in this test is to find out which one of the


IQ test

time limit per test

2 seconds

memory limit per test

256 megabytes

input

standard input

output

standard output

Bob is preparing to pass IQ test. The most frequent task in this test is to find out which one of the given n numbers 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 given n numbers finds one that is different in evenness.

Input

The first line contains integer n (3?≤?n?≤?100) ? amount of numbers in the task. The second line contains n space-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

input

41 2 1 1

output





解题报告:水题。。给你一列数,其中只有一个数的奇偶性和其他数不同,输出它所在的位置。直接暴力扫一遍,记录最后一个奇数和偶数的位置,并记录奇数和偶数的个数,即可。







AC代码:

#include #include #include #include #include #include #include #include #include #include #include #include using namespace std;#define INF 0x7fffffffint 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>a[i]; if(a[i]&1) { ans1 ++; x = i+1; } else{ ans2 ++; y = i+1; } } if(ans1>ans2) cout<

文档

CodeforcesBetaRound#25(Div.2)A.IQtest_html/css

CodeforcesBetaRound#25(Div.2)A.IQtest_html/css_WEB-ITnose:IQ test time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Bob is preparing to pass IQ test. The most frequent task in this test is to find out which one of the
推荐度:
  • 热门焦点

最新推荐

猜你喜欢

热门推荐

专题
Top