poj 3624 Charm Bracelet(0/1背包)
来源:互联网 发布:王凯电影嫌疑人知乎 编辑:程序博客网 时间:2024/05/04 22:39
题意:就是给出的N种 Charm Bracelet 使 在不超过M的情况下,val 最大
思路:基础的0/1背包模型
//212K 250MS
#include <stdio.h>
#include <string.h>
#define M 13500
int max (int a,int b)
{
return a> b? a: b;
}
int main ()
{
intdp[M];
intn,m,i,w,d;
while(~scanf ("%d%d",&n,&m))
{
memset (dp,0,sizeof (dp));
for (i = 0;i < n;i ++)
{
scanf ("%d%d",&w,&d);
for (int j = m;j >= w;j --)
dp[j] = max (dp[j],dp[j-w] + d);
}
printf ("%d\n",dp[m]);
}
}
思路:基础的0/1背包模型
//212K
#include <stdio.h>
#include <string.h>
#define M 13500
int max (int a,int b)
{
}
int main ()
{
}
- poj 3624 Charm Bracelet(0/1背包)
- Charm Bracelet
- POJ - 3624 《Charm Bracelet》 【0-1背包】
- POJ 3624 Charm Bracelet(0,1背包)
- POJ 3624 Charm Bracelet 0-1背包
- 【0-1背包】-POJ-3624-Charm Bracelet
- POJ 3624 Charm Bracelet 【0 1背包】
- POJ 3624 Charm Bracelet 0 1 背包
- POJ-3426-0-1背包Charm Bracelet
- poj 3624 Charm Bracelet(0-1背包~DP~)
- POJ 3624 Charm Bracelet(0-1背包)
- POJ 3624 Charm Bracelet (0-1背包)
- poj 3624 Charm Bracelet (0/1背包)
- POJ 3624 Charm Bracelet 赤裸裸的0-1背包
- poj 3624 Charm Bracelet DP 0/1 背包问题
- POJ 3624 Charm Bracelet (线性dp 0/1背包)
- POJ 3624 Charm Bracelet (0-1背包问题)
- poj 3624 Charm Bracelet(0-1背包 DP)
- poj 1159 Palindrome(DP)
- poj 1159 Palindrome(DP 空间压缩…
- poj 3267 The Cow Lexicon(DP)
- oracle 管理员每天的职责
- 毕业工作大记事【未完待续持续更新。。。。】
- poj 3624 Charm Bracelet(0/1背包)
- poj 3211 Washing Clothes(0/1背…
- poj 1837 Balance (01背包)(转)
- poj 1276 Cash Machine(多重背包…
- Linux时间子系统之七:定时器的应用--msleep(),hrtimer_nanosleep()
- poj 2392 Space Elevator(多重背包…
- poj 1014 Dividing(多重背包)
- 批量处理页面中所有单选、复选(至少选一个)
- poj 2184 Cow Exhibition(0/1背包…