#include<bits/stdc++.h>
using namespace std;
int main(){
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	long long n,res,cnt,x;
	cin>>n>>x;
	res=x;cnt=1;
	n--;
	while(n--){
		cin>>x;
		if(res==x){
			cnt++;
		}
		else {
			cnt--;
		}
		if(cnt<=0){
			res=x;cnt=1;
		}
	}
	cout<<res;
}

https://oj.qdturing.cn/d/A1002/p/yc2501

0 条评论

目前还没有评论...