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.

Examples
input
5
2 4 7 8 10
output
3
input
4
1 2 1 1
output
2

题解:一组数只有一个奇数或者偶数,输出它的位置.
 #include <iostream>
#include <algorithm>
#include <cstring>
#include <cstdio>
#include <vector>
#include <cstdlib>
#include <iomanip>
#include <cmath>
#include <ctime>
#include <map>
#include <set>
using namespace std;
#define lowbit(x) (x&(-x))
#define max(x,y) (x>y?x:y)
#define min(x,y) (x<y?x:y)
#define MAX 100000000000000000
#define MOD 1000000007
#define pi acos(-1.0)
#define ei exp(1)
#define PI 3.141592653589793238462
#define INF 0x3f3f3f3f3f
#define mem(a) (memset(a,0,sizeof(a)))
typedef long long ll;
const int N=;
const int mod=1e9+;
int a[N];
int main()
{
int n;
while(cin>>n){
int i,flag1,flag2,sum1=,sum2=;
for(i=;i<n;i++){
cin>>a[i];
if(a[i]%==){
flag2=i+;
sum2++;
}
else {
flag1=i+;
sum1++;
}
}
if(sum1>&&sum2>){
if(sum1==) cout<<flag1<<endl;
else cout<<flag2<<endl;
}
}
return ;
}
 

最新文章

  1. HashMap 源码解析
  2. Nutch主要类代码分析之一(Injector)
  3. js类型转化
  4. 使用C#代码部署SharePoint 2013开发包简单总结(一)
  5. 隐马尔可夫模型(Hidden Markov Model,HMM)
  6. Routing in ASP.NET Web API和配置文件的设定读取
  7. Apache Tomcat关于shtml和SSI技术
  8. bash shell——与if条件相关的参数意义
  9. cocos2d-x3.0 相对布局(一)
  10. Redis同步操作失败的原因
  11. docker 基础命令二
  12. C#基础之------委托
  13. C#中的PropertyGrid绑定对象,通过改变某一值而动态设置部分属性的特性
  14. About me &amp; 留言板
  15. SpringMvc 中的实用工具类介绍(包括 ResponseEntity、 RestTemplate、WebUtils 等)
  16. Django使用Channels实现WebSocket--下篇
  17. PyCharm快捷键使用
  18. Idea checkstyle插件的使用
  19. sshpass 实现shell脚本直接加载密登录服务器
  20. 关于安装SVN Service 出错 Service &#39;VisualSVN Server&#39; failed to start. Please check VisualSVN Server log in Event Viewer for more details

热门文章

  1. K8S集群入门:运行一个应用程序究竟需要多少集群?
  2. 教你快速使用数据可视化BI软件创建4S店销售数据大屏
  3. Shiro -- (三) 自定义Realm
  4. #《Essential C++》读书笔记# 第一章 C++ 编程基础
  5. Java基础之五、Java编程思想(1-7)
  6. Galactic Collegiate Programming Contest Gym - 101572G 模拟
  7. python_函数笔记
  8. python里奇怪的赋值
  9. 剑指offer-面试题53_3-数组中数值和下标相等的元素-二分查找
  10. 【转】为什么使用length获取Java数组的长度