摘要: 这道题目之前做过https://www.cnblogs.com/fx1998/p/13246173.html 现在复习之前的代码,明显更加轻松了 这就是二进制状态压缩 对状态转移方程新的理解: 时间复杂度2 ^ 20 * 20 需要注意的就是位运算操作与加减操作的优先级问题 下面代码的27行我错写成 阅读全文
posted @ 2020-10-27 20:23 kyk333 阅读(90) 评论(0) 推荐(0)
摘要: 注意啊,这是a * b % p,之前的快速幂是a ^ b % p,还有这道题的a,b,p都是10 ^ 18数量级的。 1 #include <bits/stdc++.h> 2 using namespace std; 3 typedef long long ll; 4 ll qmi(ll a, ll 阅读全文
posted @ 2020-10-27 16:38 kyk333 阅读(80) 评论(0) 推荐(0)
摘要: 最基本的快速幂 1 #include <bits/stdc++.h> 2 using namespace std; 3 typedef long long ll; 4 int qmi(int a, int b, int p) { 5 int ans = 1 % p; 6 while (b) { 7 阅读全文
posted @ 2020-10-27 16:02 kyk333 阅读(149) 评论(0) 推荐(0)