hdu4310 贪心】的更多相关文章

When playing DotA with god-like rivals and pig-like team members, you have to face an embarrassing situation: All your teammates are killed, and you have to fight 1vN. There are two key attributes for the heroes in the game, health point (HP) and dam…
考虑每次血口的要少 就按照一滴血多少伤害来计算.由于直接相除有小数.考虑x/y > a/b  =>  x*b >y*a; #include<stdio.h> #include<string.h> #include<algorithm> using namespace std; struct node { int hp; int dps; }a[]; bool cmp(node a,node b) { return a.dps*b.hp>a.hp*…
2017-08-26  15:25:22 writer:pprp 题意描述: • 1 VS n对战,回合制(你打他们一下,需要受到他们所有存活人的攻击)• 你的血量无上限,攻击力为1• 对手血量及攻击力给定• 消灭所有敌人掉最少的血量• n ≤ 20 贪心的去做,应该优先解决那些攻击力高血量低的敌人,所以应该按照 攻击力/血量 降序排列然后处理就好了 代码如下: /* @theme:hdu 4310 @writer:pprp @declare:简单的贪心算法 将攻击力/血量最高的敌人先进攻下来就…
题目链接:https://cn.vjudge.net/problem/HDU-4310 题意 打dota,队友太菜,局势变成1vN.还好你开了挂,hp无限大(攻击却只有一点每秒-_-). 但是你并不想被A太多下,所以问题来了 给出对面的血量和每秒输出大小 问怎么安排,使得打败所有人后掉血最少 思路 首先可以想到我们必须一个一个打,这样所有人的总输出时间最少 因为如果打A一下,B一下,AB总输出肯定更大 其次考虑1v2的情况,因为1vN同理可得 现有ab两敌人 先打a的总输出为 \[ DPS_a*…
1692: [Usaco2007 Dec]队列变换 Time Limit: 5 Sec  Memory Limit: 64 MBSubmit: 1383  Solved: 582[Submit][Status][Discuss] Description FJ打算带他的N(1 <= N <= 30,000)头奶牛去参加一年一度的“全美农场主大奖赛”.在这场比赛中,每个参赛者都必须让他的奶牛排成一列,然后领她们从裁判席前依次走过. 今年,竞赛委员会在接受队伍报名时,采用了一种新的登记规则:他们把所…
Wooden Sticks Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 15564    Accepted Submission(s): 6405 Problem Description There is a pile of n wooden sticks. The length and weight of each stick a…
FatMouse' Trade Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 56784    Accepted Submission(s): 19009 Problem Description FatMouse prepared M pounds of cat food, ready to trade with the cats g…
1691: [Usaco2007 Dec]挑剔的美食家 Time Limit: 5 Sec  Memory Limit: 64 MBSubmit: 786  Solved: 391[Submit][Status][Discuss] Description 与很多奶牛一样,Farmer John那群养尊处优的奶牛们对食物越来越挑剔,随便拿堆草就能打发她们午饭的日子自然是一去不返了.现在,Farmer John不得不去牧草专供商那里购买大量美味多汁的牧草,来满足他那N(1 <= N <= 100,…
http://codeforces.com/contest/738/problem/D Galya is playing one-dimensional Sea Battle on a 1 × n grid. In this game a ships are placed on the grid. Each of the ships consists of bconsecutive cells. No cell can be part of two ships, however, the shi…
4245: [ONTAK2015]OR-XOR Time Limit: 10 Sec  Memory Limit: 256 MBSubmit: 486  Solved: 266[Submit][Status][Discuss] Description 给定一个长度为n的序列a[1],a[2],...,a[n],请将它划分为m段连续的区间,设第i段的费用c[i]为该段内所有数字的异或和,则总费用为c[1] or c[2] or ... or c[m].请求出总费用的最小值. Input 第一行包含…