Adjusted Average
InterviewTime limit2sMemory limit128 MB
Given N exam scores, rescale each by dividing by the maximum score and multiplying by 100, then output the average of the rescaled scores.
- Level
Easy2 of 10
- Topics
- Array, Math, Implementation
- Solved
- No attempts yet
Problem
Sejun is unhappy with his final exam scores and wants to recalculate them by the following rule. First, choose the maximum current score and call it M. Then replace each score x with x / M * 100.
For example, if the highest score is 70 and the math score is 50, the math score becomes 50 / 70 * 100, or 71.43.
Write a program that computes the new average after every score is recalculated this way.
Input
The first line contains the number of subjects N. N is at most 1000.
The second line contains N current scores separated by spaces. Each score is a nonnegative integer at most 100, and at least one score is greater than 0.
Output
Print the new average on the first line. An answer is accepted if its absolute or relative error from the true answer is at most 10^-2.