Unbiased Sample Variance
Halden Bakery throws away whatever is unsold at closing, and the owner suspects the day-to-day swing is the real problem rather than the average waste. A handful of ordinary trading days are logged, giving the number of loaves left over each evening.
Those days are a sample. The owner is not asking about those particular evenings - the question is how much the leftovers swing across the bakery's trading generally, with the logged days standing in for the rest. So the number wanted is the sample variance, the unbiased one, which is the version built for exactly that claim rather than the version that describes a set as the entire population.
The owner reruns this for each of her three shops, and they do not log the same number of days.
Task: Print the unbiased sample variance of the daily leftovers. Print the raw number - no rounding is asked for.
Input
One line holding the leftover loaf counts, whole numbers separated by single spaces, one per logged day. There are at least two days.
Output
One line holding the sample variance as a float, printed raw - 3.5, never 3.
Example:
Input:
4 8 6 5 3 7
Output:
3.5
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