洛谷动态规划
撒旦即可
研究CV的菜狗
展开
-
洛谷试炼场P1060 (动态规划,01背包)
题目连接https://www.luogu.org/problemnew/show/P1060#include<bits/stdc++.h>using namespace std;int a[105];int dp[10009];int main(){ //freopen("t.txt","r",stdin); int n,m; scanf("%d%d",&...原创 2019-05-03 14:37:25 · 146 阅读 · 0 评论 -
洛谷试炼场P1616(动态规划,完全背包)
题目连接https://www.luogu.org/problemnew/show/P1616#include<bits/stdc++.h>#define N 100009using namespace std;int t[10009],c[10009];int dp[2][N];int main(){ //freopen("t.txt","r",stdin);...原创 2019-05-03 15:13:29 · 193 阅读 · 0 评论 -
洛谷试炼场P1049动态规划,装箱问题)
题目连接https://www.luogu.org/problemnew/show/P1049解题思路:f[j]表示当总容量为j时,当前可以装箱的最大值。#include<bits/stdc++.h>using namespace std;int f[20009],w[35];int main(){ //freopen("t.txt","r",stdin); in...原创 2019-05-03 15:43:31 · 175 阅读 · 0 评论 -
P1064(依赖性背包问题)
题目连接:https://www.luogu.org/problemnew/show/P1064#include<bits/stdc++.h>#define N 32005using namespace std;int f[N],manw[N],manc[N],anxw[N][3],anxc[N][3];int main(){ //freopen("t.txt",...原创 2019-05-03 18:03:34 · 269 阅读 · 0 评论 -
P1005(高精度,动态规划,值得借鉴)
题目:https://www.luogu.org/problemnew/show/P1005值得借鉴的地方:这题的动态规划递推式其实不难,难点在于高精度和动态规划的结合,第一次做到这样的题,值得借鉴代码摘自:https://www.luogu.org/problemnew/solution/P1005#include<bits/stdc++.h>using names...原创 2019-05-04 14:51:07 · 456 阅读 · 0 评论 -
P1373(网格上的动态规划,多维)
题目:https://www.luogu.org/problemnew/show/P1373题解:转移方程见代码,很简单#include<bits/stdc++.h>using namespace std;int d[802][802][16][2],a[802][802];int mod=1000000007;int main(){ //freopen("t.t...原创 2019-05-05 15:28:36 · 226 阅读 · 0 评论 -
P1220(区间DP)
题目连接:https://www.luogu.org/problemnew/solution/P1220解题思路:传递函数见代码#include<bits/stdc++.h>using namespace std;int dp[51][51][2];//dp[i][j][k]表示i和j已选,k为0表示在左边,k为1表示在右边 int sum[60];struct no...原创 2019-05-06 13:00:49 · 211 阅读 · 0 评论