#13612: 淺見

#### snakeneedy (蛇~Snake)

School : 國立高雄師範大學附屬高級中學
ID : 7661
2021-01-30 06:04:44
a044. 空間切割 -- | From: [218.164.125.30] | Post Date : 2018-03-29 13:03

1. 可以用迴圈去跑

sum = 1;for (int k = 1; k <= n; ++k) {    sum += 1 + k * (k - 1) / 2;}

2. 或者整理公式

$\bg_white 1+\Sigma_{k=1}^{n}(1+{k(k-1)\over2})=1+\Sigma_{k=1}^{n}1+\Sigma_{k=1}^{n}{k(k-1)\over2}$

$\bg_white =1+\Sigma_{k=1}^{n}1+{1\over2}(\Sigma_{k=1}^{n}k^2-\Sigma_{k=1}^{n}k)$

$\bg_white =1+n+{1\over2}\left[{1\over6}n(n+1)(2n+1)-{1\over2}n(n+1)\right]$

$\bg_white =1+n+{1\over2\times6}\left[n(n+1)(2n+1-3)\right]$

$\bg_white =1+n+{1\over6}\left[n(n+1)(n-1)\right]$

cout << 1 + n + n * (n + 1) * (n - 1) / 6 << endl;

#18113: Re:淺見

#### rexwu1104@gmail.com (黑雪公主 Black Lotus)

School : 新北市私立南山高級中學
ID : 93041
2021-04-13 22:39:27
a044. 空間切割 -- | From: [114.24.4.158] | Post Date : 2019-06-17 16:10

1. 可以用迴圈去跑

sum = 1;for (int k = 1; k <= n; ++k) {    sum += 1 + k * (k - 1) / 2;}

2. 或者整理公式

$\bg_white 1+\Sigma_{k=1}^{n}(1+{k(k-1)\over2})=1+\Sigma_{k=1}^{n}1+\Sigma_{k=1}^{n}{k(k-1)\over2}$

$\bg_white =1+\Sigma_{k=1}^{n}1+{1\over2}(\Sigma_{k=1}^{n}k^2-\Sigma_{k=1}^{n}k)$

$\bg_white =1+n+{1\over2}\left[{1\over6}n(n+1)(2n+1)-{1\over2}n(n+1)\right]$

$\bg_white =1+n+{1\over2\times6}\left[n(n+1)(2n+1-3)\right]$

$\bg_white =1+n+{1\over6}\left[n(n+1)(n-1)\right]$

cout << 1 + n + n * (n + 1) * (n - 1) / 6 << endl;

(a*a*a+5*a+6)/6

#22518: Re:淺見

#### snakeneedy (蛇~Snake)

School : 國立高雄師範大學附屬高級中學
ID : 7661
(n*n*n + 5*n)/6 + 1