题目描述
拿一个哈希表存一下就完事了
不开long long见祖宗
C++ 代码
#include <iostream>
#include <unordered_map>
using namespace std;
const int N = 610, M = 810;
unordered_map<long long, int> p;
int n, m;
int main()
{
cin >> n >> m;
for (int i = 0; i < n; i ++)
for (int j = 0; j < m; j ++)
{
long long x;
cin >> x;
p[x] ++;
if (p[x] > n * m / 2)
{
cout << x;
return 0;
}
}
}
不用开long long吧