The Judge's Score
Ridgeway Diving puts a panel of judges on every event and averages their marks, but one judge scoring from a poor angle — or with a soft spot for a home diver — can swing a medal on their own. The sport's answer is to throw away the single highest mark and the single lowest mark and average only what is left. Judges submit in seat order, which has nothing to do with how generous they are.
Task: Print the average of the marks once the highest one and the lowest one have been discarded.
Input
The first line holds one integer n, how many judges scored; n is at least 3. Each of the next n lines holds one mark as a plain number, listed in seat order. Exactly one mark is discarded at each end no matter how large the panel is.
Output
One line holding the average of the surviving marks, with exactly two digits after the decimal point.
Example:
Input:
5
9.5
8.0
9.0
9.2
4.0
Output:
8.73
Sign in to solve this problem
Reading problems is free for everyone — solving them (Run, Submit, and tracking what you've solved) needs an account.
Sign in