1054 The Dominant Color (20 point(s))

#include<iostream>
#include<cstdio>
#include<map>
using namespace std;
map<int, int> res;
int n, m, x;
int main() {
	scanf("%d%d", &m, &n);
	int half = m * n / 2;
	for(int i = 0; i < n; ++i) {
		for(int j = 0; j < m; ++j) {
			scanf("%d", &x);
			res[x]++;
			if(res[x] > half) printf("%d\n", x);
		}
	}
	return 0;
} 

 

相关文章:

  • 2021-07-11
  • 2021-09-08
  • 2021-04-25
  • 2021-09-04
  • 2021-12-18
  • 2021-11-17
  • 2021-12-19
  • 2021-06-29
猜你喜欢
  • 2022-01-26
  • 2022-12-23
  • 2022-12-23
  • 2021-05-13
  • 2021-09-08
  • 2022-12-23
  • 2021-09-16
相关资源
相似解决方案