NOI 2010 Day1 T1 能量采集
观察到 \((0, 0)\) 与 \((x, y)\) 连线上的整点个数正好是 \(\gcd(x, y) - 1\)(不包括端点),于是总能量损失即为:
\[\begin{aligned}{} & \sum\limits_{T = l}^{r}f(T, c)\sum\limits_{i = 0}^{n}p_iT^i \\ = & \sum\limits_{i = 0}^{n}p_i\sum\limits_{T = l}^{r}f(T, c)\times T^i \end{aligned} \]\[\sum\limits_{i = 1} ^ n\sum\limits_{j = 1} ^ m 2\times \gcd(i, j) - 1 = 2\times \sum\limits_{i = 1} ^ n\sum\limits_{j = 1} ^ m \gcd(i, j) - n\times m \] 标签:NOI,limits,sum,笔记,times,2010,gcd From: https://www.cnblogs.com/xhgua/p/-/NOI2010