Given an array of N integers, compute the variance using the formula:
variance = (sumSq / N) - (sum / N)^2
VarThread extends Thread holding localSum and localSumSq (both long).sum and sum of squares over its segment.join(), compute the variance with the formula above (in double).|value| ≤ 10⁴
A single line: the variance (4 decimal places).
Ví dụ:
Đầu vào:
5
1 2 3 4 5
2
Đầu ra:
2.0000
Giải thích:
Đầu vào:
4
10 10 10 10
2
Đầu ra:
0.0000
Giải thích:
Đầu vào:
1
7
1
Đầu ra:
0.0000
Giải thích:
Đầu vào:
6
1 1 1 1 1 7
3
Đầu ra:
5.0000
Giải thích:
Đang tải editor...