Normalizing a Histogram to a Density
Ashgrove Analytics monitors cloudiness at Calder Waterworks, where the permitted ceiling is 100 units. The picture is rescaled so the whole shaded area adds up to 1, which lets a day with forty samples be compared against a day with four hundred on the same axes. Underneath, the regulator wants the plain fact rather than a shape: how much of today's sampling sat above the ceiling.
Task: Print the share of readings that are strictly above 100. A reading of exactly 100 is inside the ceiling and does not count. Give the share as a number between 0 and 1, not as a percentage.
Input
The first line holds an integer n, the number of readings. Each of the next n lines holds one reading, possibly with decimals. n is at least 1.
Output
One line with exactly 2 digits after the decimal point. A share of three quarters prints as 0.75.
Example:
Input:
4
50
150
90
200
Output:
0.50
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