摘要: 简单dp 思路很清晰,注意事项及实现代码: 1 #pragma GCC optimize(2) 2 #include<bits/stdc++.h> 3 using namespace std; 4 int a[100010]; 5 int dp[100010]; 6 int ans=INT_MIN; 阅读全文
posted @ 2022-03-09 20:22 江上舟摇 阅读(49) 评论(0) 推荐(0) 编辑
摘要: 简单dp 分爬和跳两种状态考虑即可 注意事项及代码实现: 1 #include<bits/stdc++.h> 2 using namespace std; 3 int n; 4 int dp[10010][2];//0表示爬上去,1表示跳上去 ,dp表示当前楼层是爬上去的还是跳上去的 5 int a 阅读全文
posted @ 2022-03-09 20:12 江上舟摇 阅读(61) 评论(0) 推荐(0) 编辑
摘要: 混合背包顾名思义是讲0/1,多重和完全背包混合起来的背包问题,我们处理这种背包问题一般是进行条件判断处理然后在进行三个背包问题分析就可以了。 实战项目:https://www.acwing.com/problem/content/description/7/ https://www.luogu.co 阅读全文
posted @ 2022-03-05 10:37 江上舟摇 阅读(81) 评论(0) 推荐(0) 编辑
摘要: 根据这几天的学习情况,总结一下对于背包的理解和一些实现方式: 1.大名鼎鼎的0/1背包:这个就不多总结了 2.完全背包: 应该明白,通俗意义上完全背包指的是对于n个价值为v,重量为w的物品,每个物品可以无限次的取(而对于0/1来讲,则是只能取一次) 这怎么处理? 如果按照解01背包时的思路,令 f[ 阅读全文
posted @ 2022-03-04 19:56 江上舟摇 阅读(340) 评论(0) 推荐(0) 编辑
摘要: 1 //lqs原创,已上传blog,侵权必究 2 #pragma GCC optimize(2)//O2 3 #include<bits/stdc++.h> 4 using namespace std; 5 const int M=10000;//最大多少个数组 6 typedef struct n 阅读全文
posted @ 2022-03-03 10:02 江上舟摇 阅读(36) 评论(0) 推荐(0) 编辑
摘要: 题目链接:https://www.lanqiao.cn/problems/553/learning/ 题目比较清晰,这里提供两种思路供于参考;; 先说第一种思路,dfs暴搜 爆搜就不用多说了,直接开搜 需要注意的是,按照题目要求只能一个方位最大只能走九个方位,然后按照题目的要求设计就行了 这个是演算 阅读全文
posted @ 2022-03-01 21:19 江上舟摇 阅读(393) 评论(0) 推荐(0) 编辑
摘要: 第一个水题链接:https://www.dotcpp.com/oj/contest4104_problem0.html 1 #include<bits/stdc++.h> 2 using namespace std; 3 int n,m; 4 int a[110][110]; 5 int main( 阅读全文
posted @ 2022-02-27 20:05 江上舟摇 阅读(38) 评论(0) 推荐(0) 编辑
摘要: 阅读全文
posted @ 2022-02-26 16:49 江上舟摇 阅读(314) 评论(7) 推荐(0) 编辑
摘要: 题目链接:https://www.luogu.com.cn/problem/P2392 两种思路: 1、常规搜索 2.、dp0/1背包问题 这里本人只提供第一种思路,因为第二种思路我也不会(怎么就成了0/1背包)? 第一种思路具体内容: 这里知道我们在题目中有左右两个脑子,那就本题而言 我们在做某个 阅读全文
posted @ 2022-02-23 19:17 江上舟摇 阅读(208) 评论(0) 推荐(0) 编辑
摘要: ICPC冲冲冲!!! 转载地址:https://blog.csdn.net/guokaigdg/article/details/52104921 阅读全文
posted @ 2022-02-23 17:46 江上舟摇 阅读(92) 评论(0) 推荐(0) 编辑