随笔分类 - DP
摘要:1 using System; 2 namespace ConsoleApplication2 3 { 4 public class Program 5 { 6 static int[,] martix; 7 8 static string str...
阅读全文
摘要:1 #include 2 #include 3 #include 4 #include 5 #define sc(x) scanf("%d",&(x)) 6 #define pf(x) printf("%d\n", x) 7 #define CL(x, y) memset(x, y, si...
阅读全文
摘要:思路:最贵的菜一定是最后一次购买使餐卡上剩下的钱最小。输入如果小于5的话直接输出~不然先从所有菜中找出最贵的菜,然后给餐卡至少留下5块钱买这个最贵的菜,剩下的用一个0-1背包去装满! 1 #include 2 #include 3 #include 4 #include 5 #define ...
阅读全文
摘要:1 #include 2 #include 3 #include 4 #include 5 #define sc(x) scanf("%d",&(x)) 6 #define pf(x) printf("%d\n", x) 7 using namespace std; 8 const int...
阅读全文
摘要:1 #include 2 #include 3 #include 4 #include 5 #define pf(x) printf("%d\n", x) 6 #define CL(x, y) memset(x, y, sizeof(x)) 7 #define max(a, b) (a >...
阅读全文
摘要:1(最长公共子串(注意和最长公共子序列区别))两个字符串str1和str2,长度分别为(l1,l2)dp[i][j]表示以两个字符串分别以第i和第j个字符结尾所能达到的公共子序列的长度,由于下面涉及到i-1和j-1,那么这个时候我们一般从i=1和j=1开始到i 0且j> 0且ch1[i-1]= ch...
阅读全文

浙公网安备 33010602011771号