The Robust Spread
Fairhaven Health records how long each patient waited in clinic, and every week throws up a handful of extreme waits that would wreck any spread figure built on averages. The clinic therefore reports the median absolute deviation: the middle value of how far each wait sits from the middle wait. Distance is counted without regard to direction, so a wait ten minutes under the middle and one ten minutes over count as the same distance.
Task: Print the median absolute deviation of the waits.
Input
The first line holds one integer n, how many waits follow. Each of the next n lines holds one wait as a plain number. Waits arrive unsorted, and they may repeat.
Output
One line holding the median absolute deviation with exactly one digit after the decimal point.
Example:
Input:
5
1
2
3
4
100
Output:
1.0
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