A Cumulative Histogram
Ashgrove Analytics is auditing waiting times at Calder Walk-in Clinic. The picture is a running count: for every point on the minutes scale it shows how many of today's visits were done by then, so the line only ever climbs. Under it the manager wants the halfway mark spelled out in figures rather than eyeballed off the curve.
Task: Print how many waits were no longer than the middle wait. The middle wait is the one sitting in the centre once every wait is put in order. When the number of waits is even there are two in the centre, and the upper of those two is the one that counts. A wait exactly equal to the middle wait is included.
Input
The first line holds an integer n, the number of waits. Each of the next n lines holds one wait in minutes, possibly with decimals. n is at least 1.
Output
One line holding a whole number: the count of qualifying waits.
Example:
Input:
5
10
20
30
40
50
Output:
3
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