HDU 5281 Senior's Gun (贪心)】的更多相关文章

题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5281 贪心题目,但是看看我的博客里边相关贪心的题解实在是少的可怜,这里就写出来供大家一起探讨. 题意还是比较好理解的,这里有一个小小的坑点:枪的数量,和怪物的数量,不一定是相等的,所以我们这里要特殊处理一下. reverse函数:http://blog.sina.com.cn/s/blog_6d79d83a0100wh95.html #include <stdio.h> #include <…
题目连接 http://acm.hdu.edu.cn/showproblem.php?pid=5281 Senior's Gun Description Xuejiejie is a beautiful and charming sharpshooter. She often carries $n$ guns, and every gun has an attack power $a[i]$. One day, Xuejiejie goes outside and comes across $m…
Senior's Gun Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others) Total Submission(s): 616    Accepted Submission(s): 241 Problem Description Xuejiejie is a beautiful and charming sharpshooter. She often carries n guns,…
题意:给出n把枪和m个怪.每把枪有一个攻击力,每一个怪有一个防御力.假设某把枪的攻击力不小于某个怪的防御力则能将怪秒杀,否则无法杀死.一把枪最多仅仅能杀一个怪,不能用多把枪杀同一个怪.每杀一次怪能够得到枪的攻击力减去怪的防御力的的分数. 求得分的最大值. 贪心.首先我们考虑这样一种情况:用攻击力为A的枪杀防御力为a的怪,攻击力为B的枪杀防御力为b的怪.则得分为A - a + B - b. 最好还是设A ≤ B,则有a ≤ A ≤ B.b ≤ B.假设有A < b,那么我们考虑用B杀a.而不使用A…
Senior's Gun  Accepts: 235  Submissions: 977  Time Limit: 2000/1000 MS (Java/Others)  Memory Limit: 65536/65536 K (Java/Others) 问题描述 学姐姐是一个酷酷的枪手. 她常常会随身携带n把枪,每把枪有一个攻击力a[i]. 有一天她遇到了m只怪兽,每只怪兽有一个防御力b[j].现在她决定用手中的枪消灭这些怪兽. 学姐姐可以用第i把枪消灭第j只怪兽当且仅当b[j]≤a[i],同…
hdu 4825 Xor Sum(trie+贪心) 刚刚补了前天的CF的D题再做这题感觉轻松了许多.简直一个模子啊...跑树上异或x最大值.贪心地让某位的值与x对应位的值不同即可. #include <iostream> #include <cstdio> #include <cstring> #include <algorithm> #include <cmath> #define CLR(a,b) memset((a),(b),sizeof(…
题意: 给n把枪,m个怪兽,每把枪可消灭1怪兽,并获得能量=枪的攻击力-怪兽的防御力.求如何射杀能获得最多能量?(不必杀光) 思路: 用最大攻击力的枪杀防御力最小的怪兽明显可获得最大能量.如果每把枪都去射杀刚好1点能量都拿不到的怪物,那简直等于把枪全丢掉. //#pragma comment(linker,"/STACK:102400000,102400000") #include <iostream> #include <stdio.h> #include &…
题目连接 http://acm.hdu.edu.cn/showproblem.php?pid=5280 Senior's Array Description One day, Xuejiejie gets an array $A$. Among all non-empty intervals of $A$, she wants to find the most beautiful one. She defines the beauty as the sum of the interval. Th…
Elegant Construction 题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=5813 Description Being an ACMer requires knowledge in many fields, because problems in this contest may use physics, biology, and even musicology as background. And now in this prob…
Windows 10 题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=5802 Description Long long ago, there was an old monk living on the top of a mountain. Recently, our old monk found the operating system of his computer was updating to windows 10 automatical…