#P1471. Average and Variance Calculation
Average and Variance Calculation
Average and Variance Calculation
HansBug has discovered a fascinating sequence of N real numbers in a mathematics book. He wants to calculate the average and the variance of this sequence.
Given a sequence of N real numbers, compute the average and the variance. Use the formulas:
\( \text{Average } \bar{x} = \frac{1}{N}\sum_{i=1}^{N} x_i \)
\( \text{Variance } \sigma^2 = \frac{1}{N}\sum_{i=1}^{N}(x_i - \bar{x})^2 \)
Print both the average and the variance with 10 decimal places.
inputFormat
The first line contains an integer N (1 ≤ N ≤ 105), denoting the number of real numbers in the sequence.
The second line contains N space-separated real numbers.
outputFormat
Output two numbers: the average and the variance of the sequence. Both numbers should be printed with exactly 10 decimal places, separated by a space.
sample
3
1 2 3
2.0000000000 0.6666666667