//1052 有些节点并不属于链表,因此单纯排序,会有一个case过不去 #include <iostream> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <string> #include <vector> #include <algorithm> #include <map> using namespace std; int main() { int n,m,i; map<int,int> map_s; int color; int dom_color; int max_num; while(cin>>n>>m) { for(i = 0 ;i < n*m;i++) { scanf("%d",&color); map_s[color]++; } map<int,int>::iterator it = map_s.begin(); max_num = -1; for(;it!=map_s.end();it++) { if(it->second > max_num) { max_num = it->second; dom_color = it->first; } } cout<<dom_color<<endl; map_s.clear(); } return 0; }