Comparing Apples to Elephants
Thornbury Foods measures two things on the same production line: the weight in grams of a filled jar, and the number of seconds the machine takes to cap it. Asking which of the two is more erratic is meaningless in raw units, because grams and seconds cannot be set beside each other. The lab therefore quotes a coefficient of variation for each measurement — its population standard deviation expressed as a percentage of its own mean, which cancels the units out and leaves a number comparable against anything.
Task: Print the coefficient of variation of the measurements.
Input
The first line holds one integer n, how many measurements follow. Each of the next n lines holds one measurement as a plain number. Every measurement is greater than zero, so the mean is never zero.
Output
One line holding the coefficient of variation as a percentage, with exactly one digit after the decimal point and no % sign. A perfectly steady set of measurements gives 0.0.
Example:
Input:
4
10
12
8
10
Output:
14.1
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