All problems

A Histogram and a Box Plot, Stacked

mediumPythonMatplotlibCombined Charts

Kestrel Freight logs how long each parcel spends waiting at a hub. The analysis panel shows the shape of those wait times above a summary of the same numbers, so a reader can see both the long tail and the middle at once. Underneath, two figures are printed in plain text: the average wait, and the wait that sits in the middle of the pack. When they disagree, the tail is doing the work.

Task: Print the average wait and the middle wait.

Input

The first line holds one integer n, the number of parcels. Each of the next n lines holds one wait time, a number on its own.

Output

Two lines. The first is the average of all the waits. The second is the middle wait — put the waits in order and take the one in the centre. With an odd count exactly one wait sits there. With an even count two waits share the centre, and the later of the two is the one wanted. Both carry two decimal places.

Example:

Input:
5
10
12
11
13
100

Output:
29.20
12.00

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

Discussion

Sign in to join the discussion — reading is open to everyone.

Loading comments…