HDU 1114 Piggy-Bank(完全背包模板题)】的更多相关文章

题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2602 Many years ago , in Teddy’s hometown there was a man who was called “Bone Collector”. This man like to collect varies of bones , such as dog’s , cow’s , also he went to the grave …  The bone collect…
完全背包模板题 #include<cstdio> #include<cstring> #include<algorithm> using namespace std; #define inf 0x3f3f3f3f ],v[],f[]; int main() { int T,v1,v2,n; scanf("%d",&T); while(T--){ scanf("%d%d",&v1,&v2); scanf(&q…
多重背包模板题 #include<iostream> #include<cstring> #include<algorithm> using namespace std; ],w[]; ],num[]; int main() { int T,vn,n; scanf("%d",&T); while(T--){ memset(f,,sizeof(f)); scanf("%d%d",&vn,&n);//总金额 总…
HDU 1248 寒冰王座(全然背包:入门题) http://acm.hdu.edu.cn/showproblem.php?pid=1248 题意: 不死族的巫妖王发工资拉,死亡骑士拿到一张N元的钞票(记住,仅仅有一张钞票),为了防止自己在战斗中频繁的死掉,他决定给自己买一些道具,于是他来到了地精商店前. 死亡骑士:"我要买道具!" 地精商人:"我们这里有三种道具,血瓶150块一个,魔法药200块一个,无敌药水350块一个." 死亡骑士:"好的,给我一个血…
HDOJ(HDU).1114 Piggy-Bank (DP 完全背包) 题意分析 裸的完全背包 代码总览 #include <iostream> #include <cstdio> #include <cstring> #include <algorithm> #define nmax 100000 #define INF 0x3f3f3f3f using namespace std; int we[nmax],va[nmax],dp[nmax]; stru…
1086 背包问题 V2 1 秒 131,072 KB 20 分 3 级题 题目描述 有N种物品,每种物品的数量为C1,C2......Cn.从中任选若干件放在容量为W的背包里,每种物品的体积为W1,W2......Wn(Wi为整数),与之相对应的价值为P1,P2......Pn(Pi为整数).求背包能够容纳的最大价值.   输入 第1行,2个整数,N和W中间用空格隔开.N为物品的种类,W为背包的容量.(1 <= N <= 100,1 <= W <= 50000) 第2 - N +…
题目链接 http://acm.hdu.edu.cn/showproblem.php?pid=1114 题意 给出一个储钱罐 不知道里面有多少钱 但是可以通过重量来判断 先给出空储钱罐的重量 再给出装满钱币后储钱罐的重量 之后给出N种货币 pi wi pi 表示 第i件货币的价值 wi 表示第i件货币的重量 最后要求 储钱罐里面最少有多少钱 思路 完全背包模板问题 要注意初始化 因为这个是重量要刚好达到 初始化为 INF dp[0] = 0 AC代码 #include <cstdio> #in…
寒冰王座 Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 17092    Accepted Submission(s): 8800 Problem Description 不死族的巫妖王发工资拉,死亡骑士拿到一张N元的钞票(记住,只有一张钞票),为了防止自己在战斗中频繁的死掉,他决定给自己买一些道具,于是他来到了地精商店前.死亡骑士:…
Bone Collector Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 60469    Accepted Submission(s): 25209 Problem Description Many years ago , in Teddy’s hometown there was a man who was called “Bo…
题目链接 Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 52318   Accepted: 21912 Description Bessie has gone to the mall's jewelry store and spies a charm bracelet. Of course, she'd like to fill it with the best charms possible from the N(1…