Codeforces 432A

#include <stdio.h>
#include <stdlib.h>

int comp_inc(const void *first, const void *second)
{
	return *(int *)first-*(int *)second;
}

int times[2048];

int main()
{
	int n, k;
	scanf("%d %d", &n, &k);
	int i;
	for(i=0; i<n; ++i)
		scanf("%d", &times[i]);
	qsort(times, n, sizeof(int), comp_inc);
	int Count=0;
	for(i=2; i<n; )
	{
		if((5-times[i])>=k)
			++Count;
		else
			break;
		i+=3;
	}
	printf("%d\n", Count);
	return 0;
}

  @ First read data sorted from small arrival and of the first data from a data set to three. Click to view the last player remaining in each group is greater than the number of entries equal to the number of questions asked, if you meet these three players can form a team to participate in the World Cup, the teams plus one; when not satisfied, then directly out circulation loop is executed or until the end. The final value of the variable Count is the Answer.

Guess you like

Origin www.cnblogs.com/commario/p/11923928.html