Automatic Confidence Bands With Repeated x
Halden Cycle Hire runs three depots, and each one sends in its own count for the day. A single day therefore turns up several times in the upload, once per depot that reported. The dashboard chart quietly collapses those repeats into one point per day, and the finance note wants that collapsed figure for day 1 written out in full.
Task: Print the average of every value recorded on day 1.
Input
The first line holds one integer n, the number of readings, where 1 <= n <= 1000. Then come n lines, each holding a day number and a value, separated by a single space. A day number repeats when more than one depot reported on it. At least one reading is for day 1.
Output
One line holding the arithmetic mean of the day-1 values -- their total shared out equally -- rounded to 2 decimal places. The mean, not the middle value.
Example:
Input:
4
1 10
1 20
1 30
2 100
Output:
20.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