OJ-Problems-Source/HDOJ/1029_autoAC.cpp

28 lines
512 B
C++
Raw Normal View History

2016-08-12 10:14:21 +08:00
#include<stdio.h>
int main()
{
long n,num,cnt,res;
while(EOF != scanf("%d",&n))
{
cnt = 0;
while(n--)
{
scanf("%d",&num);
if(0 == cnt)
{
res = num;
cnt++;
}
else
{
if(res == num)
cnt++;
else
cnt--;
}
}
printf("%d\n",res);
}
return 0;
}