The Volatility Number
Harborlight Capital publishes a volatility figure for every fund it tracks: how far a typical day's return sits from that fund's own average return. The desk only ever holds a window of recent days, never the fund's entire history, so it quotes the sample standard deviation — the version intended for a handful of observations drawn from a much larger population, rather than the version for a complete population. The two are not the same number, and picking the wrong one quietly understates the risk.
Task: Print the sample standard deviation of the daily returns.
Input
The first line holds one integer n, how many daily returns follow; n is at least 2. Each of the next n lines holds one return as a plain number. A return may carry a decimal point and may be negative.
Output
One line holding the sample standard deviation with exactly two digits after the decimal point.
Example:
Input:
4
2
4
4
6
Output:
1.63
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