随笔分类 - 简单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+
阅读全文
划分数 白书
摘要: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
阅读全文
最长上升子序列2
摘要:1 // 前面我们用(n^2)复杂度dp求了最长公共子序列 2 // 当时dp数组定义如下: 3 // dp[i]:以末尾数结尾的最长公共子序列的长度 4 // 每次都利用前一次的结果,可以轻松求得以最后一个数为最结尾的最长公共子序列的长度 5 // if(a[i]>a[j] && dp[i]<=d
阅读全文
求最长公共子序列的长度
摘要: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
阅读全文
白书-多重部分和问题
摘要: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;
阅读全文
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;
阅读全文
完全背包问题
摘要: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
阅读全文
最长公共子序列
摘要: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
阅读全文
记忆化搜索
摘要:递归 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
阅读全文
浙公网安备 33010602011771号