As Mr. Shim (your favourite math teacher) always says, you control the numerator and he controls the denominator. While you may control the numerator, Mr. Shim can manipulate the denominator as he pleases, and thus controls the value. There are
There are however, a few concerning limitations! The most important one is that students are not allowed to have a grade over Shimnanigans have failed
. Which denominator gives the average closest to
Differences between this problem and the original problem will be bolded.
The original problem had weak test data, so this version will have stronger data. Users are encouraged to hack other submissions.
Constraints
Input Specification
The first line will contain space separated positive integers,
The next line will contain
The next line will contain
Output Specification
Output the denominator that will place the average closest to Shimnanigans have failed
. If there are two denominators that yield equally close averages, output the larger one because you love your classmates.
Sample Input 1
3 3 100
23 31 27
27 35 32
Sample Output 1
32
Sample Input 2
10 1 87
7 2 3 4 3 5 11 1 2 8
1
Sample Output 2
Shimnanigans have failed
Comments
Reply to DA_BIG_MO: The denominator is for all the numerators in list[0] .. list[N-1]
for example two, why isn't 1/1 as the only fraction giving an average of 100% an acceptable solution
you need to get 87 not 100