[补档计划] 类欧几里得算法

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了[补档计划] 类欧几里得算法相关的知识,希望对你有一定的参考价值。

$$\begin{aligned} f(a, b, c, n) & = \sum_{i = 0}^n \lfloor \frac{ai + b}{c} \rfloor \\ & = \sum_{i = 0}^n \sum_{j = 0}^{m-1} [j < \lfloor \frac{ai + b}{c} \rfloor] \\ & = \sum_{i = 0}^n \sum_{j = 0}^{m-1} [j + 1 \le \lfloor \frac{ai + b}{c} \rfloor] \\ & = \sum_{i = 0}^n \sum_{j = 0}^{m-1} [j + 1 \le \frac{ai+b}{c}] \\ & = \sum_{i = 0}^n \sum_{j = 0}^{m-1} [cj + c - b \le ai] \\ & = \sum_{i = 0}^n \sum_{j = 0}^{m-1} [cj + c - b -1 < ai] \\ & = \sum_{i = 0}^n \sum_{j = 0}^{m-1} [\frac{cj + c - b - 1}{a} < i] \\ & = \sum_{i = 0}^n \sum_{j = 0}^{m-1} [\lfloor \frac{cj + c - b - 1}{a} \rfloor < i] \\ & = \sum_{j = 0}^{m-1}\sum_{i = 0}^n [\lfloor \frac{cj + c - b - 1}{a} \rfloor < i] \\ & = \sum_{j = 0}^{m-1} (n+1 - \sum_{i = 0}^n [\lfloor \frac{cj + c - b - 1}{a} \rfloor \ge i]) \\ & = \sum_{j = 0}^{m-1} (n+1 -\lfloor \frac{cj + c - b - 1}{a} \rfloor - 1) \\ & = \sum_{j = 0}^{m-1} (n - \lfloor \frac{cj + c - b - 1}{a} \rfloor) \\ & = m \times n - \sum_{j = 0}^{m-1} \lfloor \frac{cj + (c - b - 1)}{a} \rfloor \\ & = m \times n - f(c, c-b-1, a, m-1) \end{aligned} $$

以上是关于[补档计划] 类欧几里得算法的主要内容,如果未能解决你的问题,请参考以下文章

类欧几里得算法

[P5170] 类欧几里得算法

类欧几里得算法与推导

类欧几里得算法

类欧几里得算法浅谈(部分)

类欧几里得算法