// 主元素.cpp : 此文件包含 "main" 函数。程序执行将在此处开始并结束。
#include <iostream>
using namespace std;
int A[] = { 0,5,5,3,5,1,5,7 };
void searchMain(int R[], int n)
{
int a[10000] = {0};
int max = 0;
int target = 0;
for (int i = 0; i < n; i++)
{
a[A[i]]++;
if (a[A[i]] > max)
{
max = a[A[i]];
target = A[i];
}
}
if (max > n / 2)
{
cout << target;
}
else
cout << -1;
}
int main()
{
searchMain(A, 8);
//std::cout << "Hello World!\n";
}