朴素方法 $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…
快速沃尔什变换 例题:P4717 【模板】快速沃尔什变换 (FWT) 题目描述 给定长度为 $2^n$ 两个序列 $A,B$,设 $$ C_i=\sum_{j\oplus k = i}A_j \times B_k $$ 分别当 $\oplus$ 是 or,and,xor 时求出 $C$ #include <bits/stdc++.h> …