#include<iostream>
#include<map>
using namespace std;int helper(const int a[],const int n)
{
map<int,int> m;
for(int i = 0;i<n;i++)
m[a[i]]++;
map<int,int>::iterator comp = m.begin();
for( map<int,int>::iterator it = comp;it != m.end();it++)
if(comp->second < it->second)
comp = it;
return comp->second;
}int main()
{
int a[] = {1,2,3,4,4,4,5,5,5,5,6};
cout<<helper(a,sizeof(a)/sizeof(a[0]));
}
时间: 2024-10-14 04:33:50