3207. Dropping tests

单点时限: 1.0 sec

内存限制: 256 MB

In a certain course, you take tests. If you get out of questions correct on test , your cumulative average is defined to be

Given your test scores and a positive integer , determine how high you can make your cumulative average if you are allowed to drop any of your test scores.

Suppose you take tests with scores of , , and . Without dropping any tests, your cumulative average is . However, if you drop the third test, your cumulative average becomes .


The input test file will contain multiple test cases, each containing exactly three lines. The first line contains two integers, and . The second line contains integers indicating for all . The third line contains positive integers indicating for all . It is guaranteed that . The end-of-file is marked by a test case with and should not be processed.


For each test case, write a single line with the highest cumulative average possible after dropping of the given test scores. The average should be rounded to the nearest integer.


3 1
5 0 2
5 1 6
4 2
1 2 7 9
5 6 7 9
0 0


To avoid ambiguities due to rounding errors, the judge tests have been constructed so that all answers are at least away from a decision boundary (i.e., you can assume that the average is never ).

4 人解决,4 人已尝试。

4 份提交通过,共有 9 份提交。

6.9 EMB 奖励。

创建: 2 年,9 月前.

修改: 2 年,3 月前.

最后提交: 9 月,3 周前.

来源: Stanford Local 2005