本文主要是介绍POJ 2833 The Average【优先队列】,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
新年第一题被优先队列教做人。
题目:
In a speech contest, when a contestant finishes his speech, the judges will then grade his performance. The staff remove the highest grade and the lowest grade and compute the average of the rest as the contestant’s final grade. This is an easy problem because usually there are only several judges.
Let’s consider a generalized form of the problem above. Given npositive integers, remove the greatest n1 ones and the least n2 ones, and compute the average of the rest.
Input
The input consists of several test cases. Each test case consists two lines. The first line contains three integers n1, n2 and n (1 ≤ n1, n2 ≤ 10, n1 + n2 < n ≤ 5,000,000) separate by a single space. The second line contains n positive integers ai (1 ≤ ai ≤ 108 for all is.t.
这篇关于POJ 2833 The Average【优先队列】的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!