HDU - 1029 Ignatius and the Princess IV
https://vjudge.net/problem/HDU-1029
#include<iostream>
#include<algorithm>
using namespace std;
int main()
{
int n,tt;
while(cin>>n)
{
int t,u,s=0;
for(int i=0;i<n;i++)
{
cin>>t;
if(s==0)
{
u=t;
s++;
}
else if(t!=u)
s--;
else if(t==u)
s++;
}
cout<<u<<"\n";
}
return 0;
}
本文来自博客园,作者:斯文~,转载请注明原文链接:https://www.cnblogs.com/zhiweb/p/15483266.html

浙公网安备 33010602011771号