Squared Deviations From the Mean
Fenwick College's exam board looks at how spread out a set of marks is before it signs a paper off. The first column on its worksheet is not a single spread figure but a breakdown: one number per mark, saying how much that mark on its own adds to the spread. Being above or below the centre counts the same, and a mark far from the centre counts for a great deal more than one that is only slightly off, so a single wild mark is impossible to miss on the sheet.
Task: Print each mark's squared deviation from the mean, where the mean is the ordinary arithmetic average of all the marks in the set.
Input
The first line holds a single integer n, the number of marks. Each of the next n lines holds one mark, which may carry decimals.
Output
One line holding n values, in the input order, separated by single spaces, each with two digits after the decimal point.
Example:
Input:
3
2
4
6
Output:
4.00 0.00 4.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