is a map water problem, as long as the statistics of the same maximum number of people on the line, because the same level can not be together.
#include <iostream>
#include <map>
using namespace std;
int main ()
{
int n,a,i,max;
map<int,int>m;
while (scanf ("%d", &n)!=eof)
{
max=0;
M.clear ();
for (i=0;i<n;i++)
{
scanf ("%d", &a);
m[a]++;
if (M[a]>max)
max=m[a];
}
printf ("%d\n", max);
}
return 0;
}
/* Suppose there are several pilots, {{a1,a2,a3 ... AK},{B1,B2,B3,... Bm} ... {f1,f2,f3 ..... Fn}}
. It has been ranked by rank from low to high, with the same pilot level in the same set. If the most desired
broom is needed, it can only be {a1,b1 .... F1},{a2,b2 .... F2}.. This is combined to minimize the number of brooms
. Therefore, the set of minimum number of brooms required is the largest collection of pilots, that is, the largest number of pilots of the same rank
. Therefore, it can be implemented directly using the map in STL. */