正文
增加 27 行删除 0 行
2,148 行未改动全部展开214921502151215221532154215521562 行未改动2,148 行未改动全部展开}:::::::::::success[快读]```cppinline int read(){int x=0,f=1;char ch=getchar();while (ch<'0'||ch>'9'){if (ch=='-') f=-1;ch=getchar();}while (ch>='0'&&ch<='9'){x=x*10+ch-48;ch=getchar();}return x*f;}```2 行未改动2,148 行未改动全部展开214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832 行未改动2,148 行未改动全部展开}:::::::::::success[数学]```cppstruct CNM{int fact[_], infact[_], inv[_];int qpow(int a, int b){int res = 1;while (b > 0){a %= mod;if (b & 1) res = res * a % mod;a = a * a;b >>= 1;}return res;}CNM(){inv[1] = fact[0] = infact[0] = fact[1] = infact[1] = 1;for (int i = 2; i < _; ++i)inv[i] = mod - (mod / i) * inv[mod % i] % mod, fact[i] = fact[i-1] * i % mod, infact[i] = infact[i-1] * inv[i] % mod;}int C(int n, int m) {return (n >= m && n >= 0) ? fact[n] * infact[n-m] % mod * infact[m] % mod : 0;}}C;```::::::::success[快读]```cppinline int read(){int x=0,f=1;char ch=getchar();while (ch<'0'||ch>'9'){if (ch=='-') f=-1;ch=getchar();}while (ch>='0'&&ch<='9'){x=x*10+ch-48;ch=getchar();}return x*f;}```2 行未改动