随笔分类 -  简单dp

多重集组合数 简单dp
摘要:1 #include <cstdio> 2 #include <iostream> 3 4 using namespace std; 5 6 const int max_n = 1000+2; 7 const int max_m = 1000+2; 8 const int max_a = 1000+ 阅读全文
posted @ 2020-02-05 14:57 带你AK,带你飞 阅读(198) 评论(0) 推荐(0)
划分数 白书
摘要:1 #include <iostream> 2 #include <cstdio> 3 4 using namespace std; 5 // 有关计数问题的dp 6 // 有n个无区别的物品,划分成不超过m组,求方法数取模M的余数 7 8 const int max_n=1000+2; 9 con 阅读全文
posted @ 2020-02-04 20:17 带你AK,带你飞 阅读(115) 评论(0) 推荐(0)
最长上升子序列2
摘要:1 // 前面我们用(n^2)复杂度dp求了最长公共子序列 2 // 当时dp数组定义如下: 3 // dp[i]:以末尾数结尾的最长公共子序列的长度 4 // 每次都利用前一次的结果,可以轻松求得以最后一个数为最结尾的最长公共子序列的长度 5 // if(a[i]>a[j] && dp[i]<=d 阅读全文
posted @ 2020-02-04 17:02 带你AK,带你飞 阅读(155) 评论(0) 推荐(0)
求最长公共子序列的长度
摘要:1 #include <cstdio> 2 #include <iostream> 3 4 using namespace std; 5 6 const int max_n = 1000 + 2; 7 const int max_a = 1e6 + 10; 8 9 int n; 10 int a[m 阅读全文
posted @ 2020-02-04 15:18 带你AK,带你飞 阅读(183) 评论(0) 推荐(0)
白书-多重部分和问题
摘要:1 #include <iostream> 2 #include <cstdio> 3 #include <cstring> 4 5 using namespace std; 6 7 8 const int max_n = 100 + 2; 9 const int max_a = 1e5 + 10; 阅读全文
posted @ 2020-02-04 14:58 带你AK,带你飞 阅读(139) 评论(0) 推荐(0)
01背包问题---重量范围增大
摘要:1 #include <iostream> 2 #include <cstdio> 3 #include <cstring> 4 5 6 using namespace std; 7 8 const int max_n = 100 + 2; 9 const int max_w = 1e7 + 10; 阅读全文
posted @ 2020-02-04 11:12 带你AK,带你飞 阅读(448) 评论(0) 推荐(0)
完全背包问题
摘要:1 #include <cstdio> 2 #include <cstring> 3 #include <iostream> 4 5 using namespace std; 6 7 const int max_n = 100+2; 8 const int max_W = 10000+2; 9 10 阅读全文
posted @ 2020-02-04 10:21 带你AK,带你飞 阅读(108) 评论(0) 推荐(0)
最长公共子序列
摘要:1 #include <cstdio> 2 #include <iostream> 3 #include <cstring> 4 5 using namespace std; 6 7 const int max_n = 1000+10; 8 9 int n,m; 10 char s[max_n],t 阅读全文
posted @ 2020-02-03 20:58 带你AK,带你飞 阅读(201) 评论(0) 推荐(0)
记忆化搜索
摘要:递归 1 #include <cstdio> 2 #include <cstring> 3 #include <iostream> 4 5 using namespace std; 6 7 const int max_n = 100+2; 8 9 int dp[max_n][max_n]; 10 i 阅读全文
posted @ 2020-02-03 17:15 带你AK,带你飞 阅读(363) 评论(0) 推荐(0)