Adding a Mean Marker to a Box Plot
A box plot marks the middle result and says nothing about the average, which is usually the right choice — but Thornhill Labs has been asked to show both, so a second marker is added for the average. When the two markers sit apart, the batch has a tail dragging the average away from where most of the readings actually are. The report quantifies that gap.
Task: Print the average minus the middle result. Keep the sign: a positive answer means the average sits above the middle, and a negative one means it sits below. The middle result is the reading in the centre once the batch is put in order, and the batch always holds an odd number of readings, so exactly one reading is in the centre.
Input
The first line holds an odd integer n, the number of readings. Each of the next n lines holds one reading, possibly with decimals, in no particular order. n is at least 1.
Output
One line with exactly 2 digits after the decimal point. A gap of zero prints as 0.00, and a negative gap keeps its minus sign.
Example:
Input:
5
10
12
11
13
100
Output:
17.20
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