#include<iostream>
#include<cstdio>
using namespace std;
int a[105];
int main()
{
int i, n;
int c1, c2, odd, even;
while(scanf("%d", &n)==1)
{
for(i=1; i<=n; i++)
{
scanf("%d", &a[i]);
}
c1=0, c2=0;
for(i=1; i<=n; i++)
{
if(a[i]%2==0)
{
c1 +=1;
even = i;
continue;
}
if(a[i]%2!=0)
{
c2+=1;
odd=i;
}
}
if(c1>c2)
{
printf("%d\n", odd);
}
else
{
printf("%d\n", even);
}
}
}
#include<cstdio>
using namespace std;
int a[105];
int main()
{
int i, n;
int c1, c2, odd, even;
while(scanf("%d", &n)==1)
{
for(i=1; i<=n; i++)
{
scanf("%d", &a[i]);
}
c1=0, c2=0;
for(i=1; i<=n; i++)
{
if(a[i]%2==0)
{
c1 +=1;
even = i;
continue;
}
if(a[i]%2!=0)
{
c2+=1;
odd=i;
}
}
if(c1>c2)
{
printf("%d\n", odd);
}
else
{
printf("%d\n", even);
}
}
}
No comments:
Post a Comment