The Middle Value, Verified by Hand
Fenwick College's statistics tutor makes students cross-check a library result by hand before they are allowed to trust it. The exercise for this week concerns the middle mark of a set — the mark with as many marks above it as below. Students report that middle mark twice, once as the statistics library gives it and once worked out from the marks themselves, and the two lines are expected to agree. A disagreement means the hand method has a flaw worth finding. Every set contains an odd number of marks, so there is exactly one mark in the middle.
Task: Print the middle mark twice, on two lines: the library's answer first, the hand-worked answer second.
Input
The first line holds a single integer n, the number of marks; n is always odd. Each of the next n lines holds one mark, which may carry decimals.
Output
Two lines, each holding the middle mark with exactly one digit after the decimal point. When the work is right, both lines carry the same value.
Example:
Input:
3
7
1
5
Output:
5.0
5.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