## JDCC '15 Contest 1 P3 - Test Candy

View as PDF

Points: 5
Time limit: 2.0s
Memory limit: 64M

Author:
Problem type

After a slew of poor test results, Ms. Dyke has decided to give the students who pass her tests candy as incentive for everyone to work harder. Unfortunately, candy is apparently really expensive and the department has little money. To work around this, she has decided to adjust her student's marks (by adding or subtracting some constant value from each mark) in order to minimize the amount of candy she needs to give out. However, she can't have the class average be less than or she'll get in trouble! Ms. Dyke has picked you to figure out what is the minimum number of candy she can give out, don't let her down!

#### Input Specification

The first line of the input provides the number of test cases, . test cases follow. The first line of each test case provides the number of students in her class, . The next lines each contain a real number , the mark of one of her students. Marks are given in increasing order and no two marks are the same.

#### Output Specification

A single integer denoting the minimum amount of candy she needs to give out.

#### Sample Input

2
3
60.0
70.0
80.0
3
0.0
0.15
0.3

#### Sample Output

2
2

#### Explanation for Sample

In the first case, the average is so she can lower everyone's mark by , meaning two people passed the test. In the second case, she has to raise the mark by at least , so the two highest marks must be above average.