/////////////////////////////////////////////////////////
//數組中有一個數字出現的次數超過數組長度的一半,請找出這個數字。
//例如輸入一個長度為9的數組{1,2,3,2,2,2,5,4,2}。
//由於數字2在數組中出現了5次,超過數組長度的一半,因此輸出2。
#include
using namespace std;
int Grial(int a[],int n)
{
if(n==0)return -1;
int flog = n/2;
int i = 0;
int count = 0;
for(;iflog)return a[i];
else count = 0;
}
return 0;
}
int main()
{
int a[]={1,1,1,12,3};
cout<