CF1098E

CF1098E [* easy to think, hard to code]

先算 \(b\),发现可以直接容斥+反演处理。

第二种搞法是用 \(\gcd\) 的性质做,可以做到 \(\mathcal O(n\log w)\) 计算 \(b\)

搞出 \(b\) 之后二分答案,然后用双指针扫合法的区间,对于一对 \(\rm pair\)\((a,b)\) 稍微化简一下会发现等价于统计 \(\lfloor\frac{a+bi}{c}\rfloor\) 下的点数。跑类欧就可以了。

代码枯了。

posted @ 2020-11-20 20:37  Soulist  阅读(128)  评论(0)    收藏  举报