标签:
Description
Input
Output
Sample Input
Sample Output
1 #include <iostream> 2 #include <cstdio> 3 #include <cstring> 4 using namespace std; 5 int main() 6 { 7 int t,n,num,maxn; 8 int a[1000]; 9 scanf("%d",&t); 10 while(t--) 11 { 12 scanf("%d",&n); 13 maxn=-1; 14 memset(a,0,sizeof(a)); 15 for(int i=1;i<=n;i++) 16 { 17 scanf("%d",&num); 18 a[num]++; 19 if(a[num]>maxn) 20 { 21 maxn=a[num]; 22 } 23 } 24 for(int i=1;i<=n;i++) 25 { 26 if(a[i]==maxn) 27 { 28 printf("%d\n",i); 29 break; 30 } 31 } 32 } 33 return 0; 34 }
标签:
原文地址:http://www.cnblogs.com/wangmengmeng/p/4552740.html