-
模意义下的乘法逆元模板
前导知识费马小定理:若$p$是质数,对任意整数$a$不是$p$的倍数,有$a^{p-1}\equiv 1\pmod pap−1≡1(modp)$,也可以写作$a^{p}\equiv a\pmod pap≡a(modp)$。 六百六十六居然不支持LaTeX#include <iostream& ...
-
二分模板
//整数二分 int L = 0, R= 1e9; int ans = -1; while(L <= R) { int mid = (L + R) >> 1; if(check(mid)) { ans = mid; ...