![](https://img-blog.csdnimg.cn/20201014180756919.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
贪心
文章平均质量分 53
Get *null
这个作者很懒,什么都没留下…
展开
-
HDU1257 最少拦截系统(贪心)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1257 #include #define INF 0x3f3f3f3f int n,a[30005],b[30005]; int main() { while(~scanf("%d",&n)) { for(int i=0; i<n; i++) {原创 2015-12-29 18:18:49 · 631 阅读 · 4 评论 -
合并果子(贪心+优先队列)
C - 合并果子 Crawling in process...Crawling failedTime Limit:1000MS Memory Limit:131072KB 64bit IO Format:%lld & %llu SubmitStatus Description 现在有n堆果子,第i堆有ai个果子。现在要把这些果子合并成一堆,每次合并的代价是两堆果原创 2016-01-23 16:02:33 · 2508 阅读 · 0 评论 -
HDU 2037 今年暑假不AC(贪心)
B - 今年暑假不AC Crawling in process...Crawling failedTime Limit:1000MS Memory Limit:32768KB 64bit IO Format:%I64d & %I64u SubmitStatus Description “今年暑假不AC?” “是的。” “那你干什么呢?” “看世界杯呀,笨原创 2016-01-23 17:45:45 · 855 阅读 · 0 评论 -
HDU 1009 FatMouse' Trade(贪心)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1009 小白上的部分背包问题,这里从数学的角度可以认为老鼠能得到的与能兑换到的javabean成正比,与需要付出cat food成反比,因此,得到的粮食/需要付出的猫粮越大,表示这个兑换方案更好,相当于利润。所以我肯定会选择优先兑换最优方案的,一直到无法兑换完全了,就只能兑换部分了,也就是把剩下的猫粮原创 2016-01-23 23:50:30 · 467 阅读 · 0 评论 -
HDU 1678 Shopaholic(贪心)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1678 简单的贪心题,排序即可,每三个加上那个最小值。 #include #include using namespace std; bool cmp(int x,int y) { return x>y; } int main() { int t; scanf("%d",&t原创 2016-01-24 00:18:58 · 538 阅读 · 0 评论 -
POJ 2437 Muddy roads(贪心)
题目链接:http://poj.org/problem?id=2437 #include #include #include #include using namespace std; const int INF=0x3f3f3f3f; struct Node { int st,en; } Node[10005]; bool cmp(struct Node x,struct Node y原创 2016-01-24 09:11:00 · 924 阅读 · 0 评论 -
POJ 1017 Packets(贪心)
题目链接:http://poj.org/problem?id=1017 不解释,贪心思路,可以留言讨论。 #include #include using namespace std; int num[4]= {0,5,3,1}; int main() { int a1,a2,a3,a4,a5,a6,ans1,ans2,ans3,ans4,ans5,ans6; while(~sc原创 2016-01-24 10:36:12 · 550 阅读 · 0 评论