题目大意:求众数,内存1M
题解:自行google摩尔排序算法
我的收获:Orz
#include <cstdio>
using namespace std;
int n,now,tot,x;
int main()
{
scanf("%d",&n);
while(n--)
{
scanf("%d",&x);
if(tot==0)
now=x,tot++;
else if(now==x) tot++;
else tot--;
}
printf("%d\n",now);
return 0;
}