Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

Re:up

Posted by IAC at 2006-08-18 14:42:41 on Problem 2976
In Reply To:up Posted by:sunmoonstar at 2006-08-18 14:38:10
Input 

The input test file will contain multiple test cases, each containing exactly three lines. The first line contains two integers, 1 <= n <= 1000 and 0 <= k < n. The second line contains n integers indicating ai for all i. The third line contains n positive integers indicating bi for all i. It is guaranteed that 0 <= ai <= bi <= 1, 000, 000, 000. The end-of-file is marked by a test case with n = k = 0 and should not be processed. 

Output 

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

Sample Input 


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

Sample Output 


83
100

Hint 

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

Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator