新年第一题被优先队列教做人。
题目:
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&nbs

该博客讨论了一个竞赛评分系统,其中需要去除最高和最低评分并计算平均分的问题。作者介绍了问题背景,提出了使用优先队列(堆)作为解决方案,并强调在实现最大堆时的注意事项。内容包括题目描述、解题思路和代码实现。
最低0.47元/天 解锁文章
550

被折叠的 条评论
为什么被折叠?



