1 条题解
-
-1チルノ (9Cirno) LV 7 MOD Baka 扶苏 tayz @ 2024-05-09 17:22:20
\[关于方差\]
\[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