HDOJ 5188 zhx and contest 贪婪+01背包】的更多相关文章

zhx and contest Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others) Total Submission(s): 455    Accepted Submission(s): 158 Problem Description As one of the most powerful brushes in the world, zhx usually takes part i…
HDOJ(HDU).3466 Dividing coins ( DP 01背包 无后效性的理解) 题意分析 要先排序,在做01背包,否则不满足无后效性,为什么呢? 等我理解了再补上. 代码总览 #include <iostream> #include <cstdio> #include <cstring> #include <algorithm> #define nmax 505 #define nn 505*100 using namespace std;…
HDOJ(HDU).2546 饭卡(DP 01背包) 题意分析 首先要对钱数小于5的时候特别处理,直接输出0.若钱数大于5,所有菜按价格排序,背包容量为钱数-5,对除去价格最贵的所有菜做01背包.因为这时候还剩下5块钱,直接买最贵的那个菜,就可以保证剩下来的钱数是最小的. 代码总览 #include <iostream> #include <cstdio> #include <cstring> #include <algorithm> #define nma…
HDOJ(HDU).2602 Bone Collector (DP 01背包) 题意分析 01背包的裸题 #include <iostream> #include <cstdio> #include <cstring> #include <algorithm> #define nmax 1005 using namespace std; int v[nmax],w[nmax],dp[nmax]; int main() { //freopen("in…
传送门 zhx and contest Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 145    Accepted Submission(s): 49 Problem Description As one of the most powerful brushes in the world, zhx usually takes part…
http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=3703 Happy Programming Contest Time Limit: 2 Seconds      Memory Limit: 65536 KB In Zhejiang University Programming Contest, a team is called "couple team" if it consists of only two s…
10397507 2014-03-25 23:30:21 Accepted 1203 0MS 480K 428 B C++ 泽泽 题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1203 Problem Description Speakless很早就想出国,现在他已经考完了所有需要的考试,准备了所有要准备的材料,于是,便需要去申请学校了.要申请国外的任何大学,你都要交纳一定的申请费用,这可是很惊人的.Speakless没有多少钱,总共只攒了n万美元…
A - Coins Time Limit:3000MS     Memory Limit:262144KB     64bit IO Format:%I64d & %I64u Description standard input/output Hasan and Bahosain want to buy a new video game, they want to share the expenses. Hasan has a set of N coins and Bahosain has a…
Problem Description 电子科大本部食堂的饭卡有一种非常诡异的设计,即在购买之前推断剩余金额. 假设购买一个商品之前,卡上的剩余金额大于或等于5元,就一定能够购买成功(即使购买后卡上剩余金额为负),否则无法购买(即使金额足够).所以大家都希望尽量使卡上的剩余金额最少. 某天,食堂中有n种菜出售.每种菜可购买一次. 已知每种菜的价格以及卡上的剩余金额,问最少可使卡上的剩余金额为多少.   Input 多组数据.对于每组数据: 第一行为正整数n.表示菜的数量.n<=1000. 第二行…
Problem Description As one of the most powerful brushes in the world, zhx usually takes part in all kinds of contests. One day, zhx takes part in an contest. He found the contest very easy for him. There are n problems in the contest. He knows that h…