HDU 4508 湫湫系列故事——减肥记I
2014-11-09 13:40
197 查看
http://acm.hdu.edu.cn/showproblem.php?pid=4508
简单完全背包
http://acm.hdu.edu.cn/showproblem.php?pid=4508
简单完全背包
#include <stdio.h> #include <string.h> #include <iostream> #include <algorithm> const int N=100010; using namespace std; struct job{ int value,w; }node ; int n,m,dp ; int main(){ // freopen("in.txt", "r", stdin); while(scanf("%d",&n) == 1){ for(int i=1; i<=n; i++) scanf("%d%d",&node[i].value,&node[i].w); scanf("%d",&m); memset(dp, 0, sizeof(dp)); for(int i=1; i<=n; i++){ for(int j=node[i].w; j<=m; j++){ dp[j] = max(dp[j], dp[j-node[i].w] + node[i].value); } } printf("%d\n",dp[m]); } return 0; }
相关文章推荐
- HDU 4508 湫湫系列故事——减肥记I (2013腾讯编程马拉松初赛第一场)
- hdu-4508-湫湫系列故事——减肥记I-dp-java
- 【完全背包】HDU 4508 湫湫系列故事——减肥记I
- HDU 4508 湫湫系列故事――减肥记I 【完全背包】
- HDU 4508湫湫系列故事――减肥记i-简单的完全背包
- HDU 4508 湫湫系列故事——减肥记I
- 【HDU 4508 】湫湫系列故事――减肥记I (完全背包)
- HDU 4508 湫湫系列故事——减肥记I (完全背包)
- HDU 4508--湫湫系列故事——减肥记I【完全背包】
- HDU 4508 湫湫系列故事——减肥记I (2013腾讯编程马拉松初赛第一场)
- HDU 4508.湫湫系列故事——减肥记I【背包】【算法的优化】【8月13】
- HDU 4508 - 湫湫系列故事——减肥记I
- HDU 4508 湫湫系列故事——减肥记I
- HDU 4509 湫湫系列故事——减肥记II 线段树
- HDU 4508 沼泽湿地系列故事——记住减肥I (2013腾讯编程马拉松预赛第一)
- 完全背包问题:湫湫系列故事――减肥记I(HDU 4508)
- Hdu 4508 湫湫系列故事——减肥记I (完全背包)
- 杭电4508湫湫系列故事——减肥记I
- HDU 4508 湫湫系列故事——减肥记I(完全背包)
- hdu 4508 湫湫系列故事——减肥记I