A calibration lab stores long streams of sensor measurements in a compressed ledger to save space: instead of writing every reading, the lab records each distinct reading value once alongside how many times it occurred. Given such a compressed ledger, compute the mean of the full (uncompressed) set of readings, rounded to exactly two decimal places using standard rounding (round half up when the digit immediately after the second decimal place is 5 or more).
A single line containing the mean of all readings, printed with exactly two digits after the decimal point (for example, 5.00 or 18.33).
Example 1
Input
3 10 2 20 3 30 1
Expected
18.33
Explanation
The rows expand to two 10s, three 20s, and one 30 -- nine readings totalling 10*2 + 20*3 + 30*1 = 110. The mean is 110/6 = 18.3333..., which rounds to 18.33.
Example 2
Input
2 5 1 5 1
Expected
5.00
Explanation
Two readings of 5 each give a total of 10 over 2 readings, so the mean is exactly 5, printed as 5.00 with two decimal places.
Ready to solve this?
Sign in to open the editor, run your code against the sample tests, and submit against the full test suite.
Sign in to solve →