版本比较
万能头和什么的
正文
增加 20 行删除 20 行
37 行未改动3839404142434442434445464748495046474849505152535453545556575813 行未改动7273747576767778798081828384858586878889909192939293949596979899991001011021032 行未改动10610710810911011011111211311411511611711811912012012112212312440 行未改动1651661671681691691701711711721731741758 行未改动18418518618718818818919019119218 行未改动37 行未改动## FastMod
```cpptypedef long long ll; typedef __int128 lll;struct FastMod { int m; ll b; void init(int _m) { m = _m; b = ((lll)1<<64) / m; } struct FastMod { int m; ll b; void init(int _m) { m = _m; b = ((lll)1<<64) / m; } int operator() (ll a) { ll q = ((lll)a * b) >> 64; a -= q * m; if (a >= m) a -= m; return a; } ll q = ((lll)a * b) >> 64; a -= q * m; if (a >= m) a -= m; return a; }} Mod;int add(int a, int b) { return (a += b) >= mod ? a - mod : a; }int mul(int a, int b) { return Mod(1ll * a * b); } template <typename ...Args> int mul(int a, int b) { return Mod(1ll * a * b); }template <typename ...Args>int mul(int a, Args ...b) { return mul(a, mul(b...)); }```
```cpp13 行未改动```cppnamespace joke3579 {// 返回值快读 template <typename __T> inline __T r() { inline __T r() { __T ans = 0; char ch = getchar(); bool sgn = true; while (ch != '-' && (ch < '0' || ch > '9')) ch = getchar(); if (ch == '-') sgn = false, ch = getchar(); while (ch >='0' && ch <='9') ans = (ans<<1) + (ans<<3) + (ch^48), ch = getchar(); return sgn? ans : -ans; }// 指定地点快读 template <typename __T> inline void get(__T & dest) { inline void get(__T & dest) { dest = 0; char ch = getchar(); bool sgn = false; while (ch != '-' && (ch < '0' || ch > '9')) ch = getchar(); if (ch == '-') sgn = true, ch = getchar(); while (ch >='0' && ch <='9') dest = (dest<<1) + (dest<<3) + (ch^48), ch = getchar(); if (sgn) dest = -dest; }// 闲来无事写个字符串快读 inline void getStr(char * dest, const char endAt) { // 闲来无事写个字符串快读 inline void getStr(char * dest, const char endAt) { while (*(dest-1) != endAt) *dest++ = getchar(); *--dest = '\0'; }// 扩欧 template <typename __T> inline __T exgcd(__T a, __T b, __T &n, __T &m) { inline __T exgcd(__T a, __T b, __T &n, __T &m) { if (b == 0) { n = 1, m = 0; return a; }2 行未改动 return nowgcd; }// 线性同余方程 template <typename __T> inline bool lion(__T a, __T b, __T c, __T &n, __T &m) { inline bool lion(__T a, __T b, __T c, __T &n, __T &m) { int nowgcd = exgcd(a,b,n,m); if (c % nowgcd != 0) return false; int tmp = c / nowgcd; n *= tmp; m *= tmp; return true; }// 线性算欧拉函数 template <typename __T> inline void calcPhi(int *phi, int max) { inline void calcPhi(int *phi, int max) { int prime[max+2], num = 0; bool isPrime[max+2]; memset(prime, 0, sizeof prime); memset(isPrime, true, sizeof prime);40 行未改动 return ans; }// 线性算逆元 template <typename __T> inline void calcInv(__T * inv, __T max, __T mod) { inline void calcInv(__T * inv, __T max, __T mod) { inv[1] = 1; for (int i = 2; i <= max; i++) for (int i = 2; i <= max; i++) inv[i] = 1ll*(mod - mod/i) * inv[mod % i] % mod; }// 费马小定理算逆元 template <typename __T>8 行未改动 }// BKDR Hash inline hashint calcHash(char * s) { register hashint hash = 0; while (hashint now = (hashint)*str++) while (hashint now = (hashint)*str++) hash = hash* 131 + now; return hash; }// KMP板子18 行未改动