HDU 5527 Too Rich 贪心】的更多相关文章

http://www.cnblogs.com/AOQNRMGYXLMV/p/4934747.html #include<iostream> #include<cstdio> #include<algorithm> using namespace std; ; const int inf=0x3f3f3f3f; int a[maxn]; int b[maxn]; ,,,,,,,,,}; int Solve(int t) { ; ;i>=;i--) { ||i==)…
题意: 有\(10\)种面值为\(1, 5, 10, 20, 50, 100, 200, 500, 1000, 2000\)的纸币,现在你要选最多的数量凑成\(p\)块钱. 分析: 同样分析问题的反面:设总金额为\(sum\),我们来求凑成\(sum-p\)所需要的最少的张数.那么剩下的就是凑成\(p\)的最多的张数. 如果没有\(50\)和\(500\)的面值的话,那么后一种面值都是前一种面值的倍数,显然贪心是可以的. 贪心的理由就是完全可以用大面值替换掉对应数量的小面值的钱,这样总钱数不变但…
题目链接 题意 : 给出一些固定面值的硬币的数量.再给你一个总金额.问你最多能用多少硬币来刚好凑够这个金额.硬币数量和总金额都很大   分析 : 长春赛区的金牌题目 一开始认为除了做类似背包DP那样子的DP外.别无他法 时空限制下是不可能DP的 众所周知背包DP问题贪心是错的 遂认定不是贪心方向 看到题解.真香~ 这种凑硬币问题.如果满足一个条件.那么贪心是正确的 当然和这道题目不一样.可贪心的是要求用最少的硬币凑出总金额 需要满足的条件是.可选择的硬币面额满足大面额是小面额的倍数 如果不满足上…
Too Rich Time Limit: 6000/3000 MS (Java/Others)    Memory Limit: 262144/262144 K (Java/Others)Total Submission(s): 395    Accepted Submission(s): 118 Problem DescriptionYou are a rich person, and you think your wallet is too heavy and full now. So yo…
Too Rich Time Limit: 6000/3000 MS (Java/Others)    Memory Limit: 262144/262144 K (Java/Others)Total Submission(s): 245    Accepted Submission(s): 76 Problem Description You are a rich person, and you think your wallet is too heavy and full now. So yo…
HDU 4442 Physical Examination(贪心) 题目链接http://acm.split.hdu.edu.cn/showproblem.php?pid=4442 Description WANGPENG is a freshman. He is requested to have a physical examination when entering the university. Now WANGPENG arrives at the hospital. Er-.. Th…
Too Rich Time Limit: 6000/3000 MS (Java/Others)    Memory Limit: 262144/262144 K (Java/Others)Total Submission(s): 1850    Accepted Submission(s): 480 Problem Description You are a rich person, and you think your wallet is too heavy and full now. So…
题目链接 题意 给出p块钱,现在要用十种硬币凑出,每种硬币有c[i]个,问最多能用多少个硬币. 思路 首先确定,对于每个硬币就是能用小的替换就不用大的. 所以,可以先把硬币尽量用小的替换,如果小的不够用,再用大的去替换. 根据这个思路,就可以处理出一个前 i 个硬币总价值的前缀和 pre[],从大的面额到小面额去枚举,当前这种面额的硬币至少需要使用 (sum - pre[i-1]) / val[i] 种,sum代表当前还剩下多少钱要去兑换,这个数要向上取整,然后继续dfs下去就可以了. 还有一种…
Too Rich Time Limit: 6000/3000 MS (Java/Others)    Memory Limit: 262144/262144 K (Java/Others)Total Submission(s): 1666    Accepted Submission(s): 422 Problem Description You are a rich person, and you think your wallet is too heavy and full now. So…
Danganronpa 题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=5835 Description Chisa Yukizome works as a teacher in the school. She prepares many gifts, which consist of n kinds with a[i] quantities of each kind, for her students and wants to hold a cl…