摘要:
BSGS模板题 代码如下 cpp include using namespace std; typedef long long LL; LL fpow(LL a, LL b, LL c) { LL ret = 1 % c; for (; b; b = 1, a = a a % c) { if (b 阅读全文
摘要:
代码如下 cpp include using namespace std; typedef long long LL; const LL mod = 998244353, g = 3, ig = 332748118; inline LL fpow(LL a, LL b) { LL ret = 1 % 阅读全文
摘要:
题目大意:给定一个长度为 N 的序列,现有 M 种颜色,选出一些颜色对这个序列进行染色,要求相邻元素颜色不相同。求最终序列恰好有 K 种不同颜色的染色方案数,结果对1e9+7取模。 题解:二项式反演 代码如下 cpp include using namespace std; typedef long 阅读全文
摘要:
$N \le 2000, M \le 2000$ 直接利用递推式预处理即可。 代码如下 cpp include using namespace std; const int mod = 1e9 + 7; int main() { ios::sync_with_stdio(false); cin.ti 阅读全文