摘要: 原题链接 考察:矩阵快速幂 思路: 矩阵快速幂的入门题,记住模板. 1 #include <iostream> 2 #include <cstring> 3 #include <algorithm> 4 #include <cstdio> 5 using namespace std; 6 typed 阅读全文
posted @ 2021-03-01 20:49 acmloser 阅读(49) 评论(0) 推荐(0) 编辑
摘要: 原题链接 考察:计数dp 错误思路: 以最后一个数来划分...f[i][j]表示选i个数,总能量为j的方案数 f[i][j] +=f[i-1][j-k](0<=k<=j)k表示最后一个数是k. 此思路错在会计重. 正确思路: 按照集合中最小的数是0和>0来划分.f[i][j]表示和为i,数个数为j的 阅读全文
posted @ 2021-03-01 16:26 acmloser 阅读(74) 评论(0) 推荐(0) 编辑
摘要: 原题链接 考察:IDA* or 状压+背包dp 思路一: n个物品包,每个都可以用二进制表示,f[i][j]表示前i个物品组成j状态最少需要多少包,状态转移方程为 int t = min(f[i-1][j|candy[i]],f[i-1][j]+1); f[i][j|candy[i]] = min( 阅读全文
posted @ 2021-03-01 12:28 acmloser 阅读(53) 评论(0) 推荐(0) 编辑