|
||||||||||
Moonfang's BirthdayTime Limit: 5000/2000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 1158 Accepted Submission(s): 492 Problem Description It's Moonfang's birthday,and his friends decided to buy him a copy of XianJianQiXiaZhuan V. Since some of friends have more money available than others, nobody has to pay more than he can afford. Every contribution will be a multiple of 1 cent,i.e.,nobody can pay fractions of a cent. Everybody writes down the maxumum amount he is able to contribute. Taking into account these maximum amounts from everybody, your task is to share the cost of the present as fairly as possible. That means, you minimize the largest distance of the contributions to 1/n-th of the total cost. In case of a tie, minimize the second largest distance, and so on. Since the smallest unit of contribution is 1 cent, there might be more than one possible division of the cost. In that case, persons with a higher maximum amount pay more. If there is still ambiguity, those who come first in the list pay more. Since you bought the present, it is your task to figure out how much everybody has to pay. Input On the first line a positive integer: the number of test cases, at most 200. After that per test case:
Output Per test case:
Sample Input
Sample Output
Source | ||||||||||
|