1 条题解
-
1琪露诺 (9Cirno) LV 8 MOD Baka tayz @ 2024-06-06 18:16:35
\[关于方差\]
\[S^2 = \frac{1}{n} \sum^{n}_{i = 1}(x_i - \overline{x})^2\]
\[S^2 = \frac{1}{n} \sum^{n}_{i = 1}(x_i^2 - 2x_i\overline{x} + \overline{x}^2)\]
\[S^2 = \frac{1}{n} (\sum^{n}_{i = 1}x_i^2 - 2\overline{x}\sum^{n}_{i = 1}{x_i} + n\overline{x}^2)\]
\[S^2 = \frac{1}{n} (\sum^{n}_{i = 1}x_i^2 - 2n\overline{x}^2 + n\overline{x}^2)\]
\[S^2 = \frac{1}{n} (\sum^{n}_{i = 1}x_i^2 - n\overline{x}^2)\]
\[S^2 = \frac{1}{n} \sum^{n}_{i = 1}x_i^2 - \overline{x}^2\]
由上可得,我们只需要维护一个区间和以及一个区间平方和即可。
- 1