Variance, the Squared Spread
Riverbend Supply judges a courier on consistency as well as speed. A courier who always takes eleven minutes is easier to plan around than one who takes five minutes on Monday and seventeen on Tuesday, even if both average the same. The operations report carries the variance of the delivery times for a completed run of deliveries. That run counts as the whole record rather than a sample of a longer history, so the population variance is the one reported.
Task: Print the population variance of the delivery times.
Input
The first line holds a single integer n, the number of deliveries. Each of the next n lines holds one delivery time in minutes, which may carry decimals.
Output
One line holding the variance with exactly two digits after the decimal point. A run where every delivery took the same time prints as 0.00.
Example:
Input:
4
10
12
8
10
Output:
2.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