2022年10月31日
摘要: n^3 #include <iostream> #include <algorithm> #include<cstring> #include <vector> using namespace std; const int N=600; int n,m,a[N],b[N],p[N][N],f[N][ 阅读全文
posted @ 2022-10-31 23:02 towboat 阅读(20) 评论(0) 推荐(0)
摘要: 01背包,这题设计状态f[i][j] 为刚好用完时间 j 时的歌曲数,这样方便找到用时(初始化设置一下就好 #include <iostream> #include <algorithm> #include<cstring> using namespace std; const int N=53,M 阅读全文
posted @ 2022-10-31 20:04 towboat 阅读(16) 评论(0) 推荐(0)
摘要: 给出了一些砖块,砖块有高度,最高可以达到的高度(高度限制)和数量,问可以用这些砖块堆的最大高度 f[i][j] 考虑前i块,能否堆出高度为j f[i][j] | =f[i-1][j-k*h[i] ] 注意先排个序,按照 limit[i] 从小到大 枚举 j #include <iostream> # 阅读全文
posted @ 2022-10-31 15:56 towboat 阅读(24) 评论(0) 推荐(0)
摘要: 一共有n座城市,要在这n座城市旅游k天,从城市1出发,第k天到达城市n。 输入有n*(n-1)行,每n-1行代表i到除了i之外的其他城市航班的天数以及价格。 求最小花费。 #include <iostream> #include <algorithm> using namespace std; co 阅读全文
posted @ 2022-10-31 00:30 towboat 阅读(18) 评论(0) 推荐(0)