摩尔投票法:参考【牛客458374228号】,做个记录
超半的数
https://ac.nowcoder.com/acm/problem/22222
#include<iostream>
using namespace std;
int main(){
int n;cin>>n;
int a,count = 0,res;
cin>>a;
res = a;
n--;
while(n--){
cin>> a;
if(!count) {
res = a;
count = 1;
}
else if ( res != a) count--;
else count++;
}
cout<<res;
return 0;
}

