2013-12-1出現最多的數

90分

 

#include<iostream>
using namespace std;
int main ()
{
	int a[10000+1],n,s[1000];
	for(int i=1;i<=1000;i++)
	a[i]=0;
	cin >> n;
	while ( n-- )
	{
		cin>>s[n];
		a[s[n]]++;
	}
	int max=0,x;
	for(int i=1;i<=1000;i++)
	if(max<a[i])
	{
	    x=i;
		max=a[i];
		}
	cout<<x<<endl;
	return 0;
 } 

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章