链接:http://acm.nyist.net/JudgeOnline/problem.php?pid=95
理解题意后就很简单了..数组标记法
#include <iostream>
using namespace std;
int sign[100000];
int main()
{
int n;
int m;
cin>>n;
int i;
int tem;
int ans;
while(n--)
{
ans=0;
cin>>m;
for(i=0;i<100000;i++)
sign[i]=0;
for (i=0;i<m;i++)
{
cin>>tem;
sign[tem]++;
}
for (i=0;i<100000;i++)
{
if(ans<sign[i])
{
ans=sign[i];
tem=i;
}
}
cout<<tem<<" "<<ans<<endl;
}
return 0;
}