矩阵类 构造函数 struct Matrix { int n, m; vector< vector<int> > a; void clear() { vector<int> tmp(m + 1); a.resize(0); for (int i = 0; i <= n; i++) { a.push_back…
行列式求值 struct Matrix { int n, m; vector< vector<int> > a; void clear() { vector<int> tmp(m + 1); a.resize(0); for (int i = 0; i <= n; i++) { a.push_back(tm…
性质 线性基的二进制最高位互不相同 原序列里面的任意一个数都可以由线性基里面的一些数异或得到 线性基里面的任意一些数异或起来都不能得到 $0$ 线性基里面的数的个数唯一,并且在保持性质一的前提下,数的个数是最少的 线性基的基本操作 最大化异或和 P3812 【模板】线性基 题目大意: 给 $n$ 个数,最大化异或和 #include <bit…
Burnside 引理 $$ |X/G|=\frac{1}{|G|}\sum_{g\in G}X^g $$ 其中, $X^g$ 为 $X$ 在 $g$ 作用下的不动点的数量。即满足 $g(x)=x$ 这样的 $x$ 的数量. 文字描述:$X$ 在置换群 $G$ 作用下的等价类总数等于每一个 $g$ 作用于 $X$ 的不动点的算数平均值. 例题 题目…
朴素方法 $n$ 个点 $(x_i,y_i)$ 可以唯一地确定一个多项式 $y = f(x)$。 给定这 $n$ 个点,请你确定这个多项式,并求出 $f(k) \bmod 998244353$ 的值。 #include <bits/stdc++.h> using namespace std; const int P = 99824435…
普通多项式乘法 #include <bits/stdc++.h> using namespace std; #define SZ(o) (int)o.size() namespace FFT { typedef double db; typedef vector<double> vdb; const int N = 3e6 …
常用函数与定义 #include <bits/stdc++.h> using namespace std; #define SZ(x) ((int)(x).size()) typedef vector<int> VI; typedef long long ll; const int P = 998244353; void p…
有了多项式求逆和多项式乘法,以此为基础,可以类似前面 NTT 的做法写出各种函数。 #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<ll,ll> pll; typedef pair<int, int>…
常系数齐次递推 题目大意: 求一个满足 $k$ 阶齐次线性递推数列 $a_i$ 的第 $n$ 项,即: $$ a_n=\sum\limits_{i=1}^{k}f_i \times a_{n-i} $$ 第一行两个数 $n$,$k$;第二行 k 个数,表示 $f_1 \ f_2 \ \cdots \ f_k$;第三行 $k$ 个数,表示 $a_0 …
朴素积分 $$ \int_L^R\frac{cx+d}{ax+b}\mathrm{d}x $$ #include <bits/stdc++.h> using namespace std; typedef double db; typedef db func(db); db a, b, c, d, L, R; db f(db x) { r…