#P10505. Dropping Test
Dropping Test
Problem Description
In a certain course, you need to take tests.
If in test (which has a total of questions) you answered questions correctly, then your cumulative average score is defined as
$$100\times \dfrac{\displaystyle \sum_{i=1}^n a_i}{\displaystyle \sum_{i=1}^n b_i}$$Given your test scores and a positive integer , if you are allowed to drop any test scores, what is the maximum possible value of your cumulative average score.
Suppose you took tests, with scores , , and .
Without dropping any test score, your cumulative average score is
$$100\times \frac{5+0+2}{5+1+6} \approx 58.33 \approx 58$$However, if you drop the third score, then your cumulative average score becomes
Input Format
The input contains multiple test cases. Each test case consists of three lines.
For each test case, the first line contains two integers and .
The second line contains integers, representing all .
The third line contains integers, representing all .
When the input case has , it indicates the end of input, and this case should not be processed.
Output Format
For each test case, output one line containing the result: the maximum possible cumulative average score when dropping test scores.
The result 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
83
100
Hint
Constraints: , , 。
Translated by ChatGPT 5