hdu-1800 Flying to the Mars

Source: Internet
Author: User

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. */


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.