E-COM-NET
首页
在线工具
Layui镜像站
SUI文档
联系我们
推荐频道
Java
PHP
C++
C
C#
Python
Ruby
go语言
Scala
Servlet
Vue
MySQL
NoSQL
Redis
CSS
Oracle
SQL Server
DB2
HBase
Http
HTML5
Spring
Ajax
Jquery
JavaScript
Json
XML
NodeJs
mybatis
Hibernate
算法
设计模式
shell
数据结构
大数据
JS
消息中间件
正则表达式
Tomcat
SQL
Nginx
Shiro
Maven
Linux
11292
UVa
11292
- Dragon of Loowater
题目:一条龙有n个头。有m个勇者。勇者的能力值大于龙头的大小就能打败他,每一个勇者须要能力值对等的佣金, 问使用至少多少钱能够杀掉龙。分析:贪心。首先,将龙和勇者斗都递增排序;然后,每次雇佣当前能力值最小的能够杀龙的勇者就可以。 (假设当前的勇者导致不适最优解,则他之前有比他佣金高的,则他一定更早被雇佣)说明:田忌赛马(⊙_⊙)。#include #include #inclu
mengfanrong
·
2016-02-04 10:00
例题5-1 UVA
11292
The Dragon of Loowater勇者斗恶龙
很简单的一道题,输入完骑士和恶龙后,sort排序,然后扫面骑士,发现骑士大于等于恶龙,费用就加,否则继续循环,直到恶龙到n及时跳出循环:#include #include usingnamespacestd; constintmaxn=20000+5; intKnight[maxn]; intDragon[maxn]; intmain() { intn,m; while(~scanf("%d%d"
aozil_yang
·
2015-12-17 00:00
C语言
uva
大白书 1.1节 思维的体操
大白书1.1节例题1UVA
11292
排序后贪心,每条恶龙用当前剩下的能力值最小的骑士源码:#include #include #include #include #include #include #include
beihai2013
·
2015-11-29 15:00
金币能力UVA
11292
:Dragon of Loowater
每日一贴,今天的内容关键字为金币能力 题意:恶龙有n个头,每个头直径x,国王可以雇佣m个骑士,每个骑士能力为y,能砍半径y的头,雇佣金为y,不能重复雇佣,问最少能消费多少金币 思路:对两者停止排序,然后停止比拟相加便可 每日一道理
·
2015-11-13 08:56
water
UVA
11292
- Dragon of Loowater
Problem C: The Dragon of Loowater Once upon a time,
·
2015-11-12 11:23
water
uva-----
11292
The Dragon of Loowater
Problem C: The Dragon of Loowater Once upon a time, in the Kingdom of Loowater, a minor nuisance turned into a major problem. The shores of Rellau Creek in central Loowater had always been a prime b
·
2015-11-11 19:08
water
贪心/思维题 UVA
11292
The Dragon of Loowater
题目传送门 1 /* 2 题意:n个头,m个士兵,问能否砍掉n个头 3 贪心/思维题:两个数组升序排序,用最弱的士兵砍掉当前的头 4 */ 5 #include <cstdio> 6 #include <cstring> 7 #include <algorithm> 8 using namespace std; 9 10
·
2015-11-11 12:40
water
《算法竞赛入门经典训练指南》第一章例题及习题列表
问题求解策略 (General Problem Solving Techniques) 例题 (Examples) 例题 1 UVa
11292
The Dragon of Loowater
·
2015-11-11 06:19
算法
[UVA]
11292
- Dragon of Loowater
Problem C: The Dragon of Loowater Time limit: 1.000 seconds Once upon a time, in the Kingdom of Loowater, a minor nuisance turned into a major problem. The shores of Rellau Creek in central Loowa
·
2015-11-11 05:12
water
Uva
11292
Dragon of Loowater
最近再开刘汝佳的算法竞赛入门经典,用它来练题。 1.1思维的体操 题意: 勇者斗恶龙 你的王国立有一条n个头的恶龙,你希望雇一些骑士把它杀死(即砍掉所有头)。村里有m个骑士可以雇佣,一个能力值为x的骑士可以砍掉一个直径不超过x的头,且需要支付x个金币。如何雇佣骑士才能砍掉恶龙的所有头,且需要支付的金币最少?注意,一个骑士只能砍一个头(且不能被雇佣两次) 
·
2015-11-10 23:06
water
UVA
11292
- The Dragon of Loowater (water)
http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=24&page=show_problem&problem=2267 题目大意:n条恶龙,m个勇士,用勇士来杀恶龙。一个勇士只能杀一个恶龙。而且勇士只能杀直径不超过自己能力值的恶龙。每个勇士需要支付能力值一
·
2015-11-10 22:38
water
uva
11292
Dragon of Loowater<贪心>
链接:http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&category=&problem=2267&mosmsg=Submission+received+with+ID+11118596 View Code 1 #inc
·
2015-11-05 09:52
water
UVa
11292
The Dragon of Loowater 【贪心】
题意:有一条有n个头的恶龙,有m个骑士去砍掉它们的头,每个骑士可以砍直径不超过x的头,问怎样雇佣骑士,使花的钱最少 把头的直径从小到大排序,骑士的能力值也从小到大排序,再一个一个地去砍头 1 #include<iostream> 2 #include<cstdio> 3 #include<cstring> 4 #include
·
2015-11-02 14:41
water
uva
11292
Dragon of Loowater (勇者斗恶龙)
Problem C: The Dragon of Loowater Once upon a time, in the Kingdom of Loowater, a minor nuisance turned into a major problem. The shores of Rellau Creek in central Loowater had always been a prime
·
2015-11-01 12:00
water
《算法竞赛入门经典——训练指南》第一章相关内容
问题求解策略 (General Problem Solving Techniques) 例题 (Examples) 例题 1 UVa
11292
The Dragon
·
2015-10-31 17:50
算法
UVA
11292
Dragon of Loowater
Time Limit:1000MS Memory Limit:0KB 64bit IO Format:%lld & %llu Submit Status Practice UVA
11292
·
2015-10-31 15:58
water
Uva
11292
The Dragon of Loowater(排序后贪心)
Problem C: The Dragon of Loowater Once upon a time, in the Kingdom of Loowater, a minor nuisance turned into a major problem. The shores of Rellau Creek in central Loowater had always been a prime
·
2015-10-31 12:02
water
[ACM_水题] UVA
11292
Dragon of Loowater [勇士斗恶龙 双数组排序 贪心]
Once upon a time, in the Kingdom of Loowater, a minor nuisance turned into a major problem. The shores of Rellau Creek in central Loowater had always been a prime breeding ground for g
·
2015-10-31 11:36
water
《算法竞赛入门经典——训练指南》第一章—算法设计基础
问题求解策略 例题 例题 1 UVa
11292
The Dragon of Loowater 排序后用贪心法 例题 2 UVa11729 Commando War 用贪心法求最优排列
·
2015-10-31 09:53
算法
The Dragon of Loowater_uva
11292
_poj3646
排序+贪心 注意边界的处理。 我是用龙的头数进行for循环,依次对骑士进行选择。假如符合条件的骑士都用完了,而龙头还没有砍完,则不成功。 32ms 1 #include<cstdio> 2 #include<algorithm> 3 using namespace std; 4 const int _max=20
·
2015-10-30 11:38
water
UVa
11292
Problem C: The Dragon of Loowater Once upon a time, in the Kingdom of Loowater, a minor nuisance turned into a major problem. The shores of Rellau Creek in central Loowater had always been a prime b
·
2015-10-27 14:02
uva
UVa
11292
.Dragon of Loowater【贪心】【10月6】
DragonofLoowater你的王国有n头龙,你希望雇佣一些骑士把它杀死(即砍掉所有头)。村里有m个骑士可以雇佣。一个能力值为x的骑士可以砍掉恶龙一个直径不超过x的头,且需要支付x个金币。一个骑士只能砍一个。求花费最小。贪心,代码如下:#include #include #include usingnamespacestd; intmain(){ intn,m; while(scanf("%d
a995549572
·
2015-10-06 09:00
C++
ACM
HDU
贪心
UVA
11292
Dragon of Loowater
#include #include #defineMAX20000 intheadHight[MAX+1]; intknightHight[MAX+1]; intcmp(constvoid*a,constvoid*b){ return*(int*)a-*(int*)b; } intmain() { intnumOfHeads,numOfKnights; while(scanf("%d%d"
tiutiu2011
·
2015-10-01 20:00
uva
of
dragon
11292
Loowater
uva
11292
好长的英语题(简单的题目)
ProblemC:TheDragonofLoowaterOnceuponatime,intheKingdomofLoowater,aminornuisanceturnedintoamajorproblem.TheshoresofRellauCreekincentralLoowaterhadalwaysbeenaprimebreedinggroundforgeese.Duetothelackofpr
qiuxueming_csdn
·
2015-08-30 20:00
UVA -
11292
Dragon of Loowater
vjudge上的题目是PDF,不方便复制,这里上链接 http://acm.hust.edu.cn/vjudge/problem/viewProblem.action?id=19048 感慨vjudge真是好东西,要不都不知道刘汝佳书上的题目要怎么刷,题目英文有点多,大意就是一只怪物n个头,m个骑士去砍头,每个头有一个值为i,能力为k的骑士每次能砍下值小于等于k的
sinat_29278271
·
2015-08-28 09:00
贪心算法
ACM集训日志——day1——15.7.8
UVA
11292
TheDragonofLoowater题意给n个头,m个骑士,骑士有能力值x,代表他可以砍掉一个直径不超过x的头,并且佣金为x,求要砍掉所有的头,需要的最少佣金是多少。
杰斯特丹第
·
2015-07-08 23:00
UVA
11292
Dragon of Loowater
题目链接:TheDragonofLoowater题面:ProblemC:TheDragonofLoowaterOnceuponatime,intheKingdomofLoowater,aminornuisanceturnedintoamajorproblem.TheshoresofRellauCreekincentralLoowaterhadalwaysbeenaprimebreedinggrou
David_Jett
·
2015-05-20 20:00
入门
uva
贪心
最水题
uva
11292
一次就ac的水题,纪念一下,今天听到小公主说,做专题提高才快,很有道理啊!~以后思维题,算法题都要做!#include #include #include #include #include usingnamespacestd; inthead[20005],can[20005]; intmain() { intn,m; while(scanf("%d%d",&n,&m)&&n&&m) { for
yexiaohhjk
·
2015-04-28 00:00
【索引】General Problem Solving Techniques:Examples
BeginningAlgorithmContests--TrainingGuide(RujiaLiu)Chapter1.AlgorithmDesign::GeneralProblemSolvingTechniques:Examples
11292
kl28978113
·
2015-04-19 15:00
UVA
11292
Dragon of Loowater(贪心+排序)
DescriptionProblemC:TheDragonofLoowaterOnceuponatime,intheKingdomofLoowater,aminornuisanceturnedintoamajorproblem.TheshoresofRellauCreekincentralLoowaterhadalwaysbeenaprimebreedinggroundforgeese.Dueto
Misdom_Tian_Ya
·
2015-04-17 11:00
例题1.1 勇者斗恶龙 UVa
11292
1.题目描述:点击打开链接2.解题思路:本题用贪心法解决,事先对恶龙的直径,能力值从小到大排序,由于要试图杀掉所有的恶龙,因此枚举每只恶龙,用cur来表示当前骑士的下标,如果他恰好能杀掉恶龙,就用他,否则尝试下一个。如果cur与m相等时退出循环,若此时恶龙仍未被杀光,则无解,反之输出ans。3.代码:#define_CRT_SECURE_NO_WARNINGS #include #include
u014800748
·
2015-03-09 23:00
贪心法
UVA
11292
Dragon of Loowater
#include #include usingnamespacestd; #defineMAX25000 intmain() { intn,m,i,j,val; intq[MAX],l[MAX]; while(scanf("%d%d",&n,&m)!=-1&&n&&m) { val=0; for(i=0;i=m) break; //printf("%d",val); } if(i
Ash_Zheng
·
2015-02-21 13:00
刘汝佳
UVA -
11292
Dragon of Loowater
题目大意:王国里有n头恶龙,m个勇士,每个勇士有不同的能量值l[i],以击杀恶龙头直径d[j]小于l[i]的恶龙。雇佣能量值为l[i]的勇士需要l[i]的金钱,每个勇士只能被租用一次,问说如何租用勇士击杀恶龙所用的金钱最小。解题思路:为了使得金钱的总额最小,那么就要雇佣能量值小得去击杀恶龙,但是又必须保证能将恶龙杀死,所以对于每个恶龙来说,需要租用能量值尽量小且大于恶龙头的直径的勇士,并且没有被租
kl28978113
·
2015-02-19 21:00
UVa
11292
The Dragon of Loowater (贪心)
题目大意:你的王国里有一条n个头的恶龙,你希望雇佣一些骑士把它杀死(也就是砍掉所有的头)。村里有m个骑士可以雇佣,一个能力值为x的骑士可以砍掉恶龙一个直径不超过x的头,且需要支付x个金币。如何雇佣骑士才能砍掉恶龙所有的头,并且支付最小的金币?注意,一个骑士只能砍一个头并且仅能被雇佣1次解析:因为要保证用的钱最少,所以先把骑士按照能力值从小到大进行排序。然后从最小的开始一个一个进行匹配。在进行匹配的
HelloWorld10086
·
2015-02-04 20:00
uva
11292
【贪心】【Uva
11292
】 勇者斗恶龙
直接用白书上的翻译吧例题1 勇者斗恶龙(TheDragonofLoowater,UVa
11292
)你的王国里有一条n个头的恶龙,你希望雇一些骑士把它杀死(即砍掉所有头)。
zy691357966
·
2014-10-08 16:00
UVA之
11292
- Dragon of Loowater
ProblemC:TheDragonofLoowaterOnceuponatime,intheKingdomofLoowater,aminornuisanceturnedintoamajorproblem.TheshoresofRellauCreekincentralLoowaterhadalwaysbeenaprimebreedinggroundforgeese.Duetothelackofpr
SunnyYoona
·
2014-05-02 08:00
面试
校园招聘
uva
剑指offer
UVA-
11292
- Dragon of Loowater-2014年4月19日100424
ProblemC:TheDragonofLoowaterOnceuponatime,intheKingdomofLoowater,aminornuisanceturnedintoamajorproblem.TheshoresofRellauCreekincentralLoowaterhadalwaysbeenaprimebreedinggroundforgeese.Duetothelackofpr
u011676797
·
2014-04-19 17:00
UVa
11292
The Dragon of Loowater 简单的比较题
Onceuponatime,intheKingdomofLoowater,aminornuisanceturnedintoamajorproblem.TheshoresofRellauCreekincentralLoowaterhadalwaysbeenaprimebreedinggroundforgeese.Duetothelackofpredators,thegeesepopulationwa
q745401990
·
2014-02-23 08:00
勇者斗恶龙(The Dragon of Loowater) UVa
11292
HDU 1902
ProblemDescriptionOnceuponatime,intheKingdomofLoowater,aminornuisanceturnedintoamajorproblem.TheshoresofRellauCreekincentralLoowaterhadalwaysbeenaprimebreedinggroundforgeese.Duetothelackofpredators,th
jack85986370
·
2014-02-04 17:00
HDU
uva
UVa
11292
Spreading the Wealth 勇者斗恶龙
对恶龙的头和骑士的能力排一次序即可代码:#include #include #include #include #include usingnamespacestd; #defineMAXSIZE20005 inta[MAXSIZE],b[MAXSIZE]; intmain() { intm,n; while(scanf("%d%d",&m,&n)!=EOF&&m+n) {
u012659423
·
2014-01-15 16:00
【索引】General Problem Solving Techniques:Examples
BeginningAlgorithmContests--TrainingGuide(RujiaLiu)Chapter1.AlgorithmDesign::GeneralProblemSolvingTechniques:Examples
11292
u011328934
·
2013-12-08 22:00
uva
11292
- Dragon of Loowater(贪心)
题目链接:uva
11292
-DragonofLoowater题目大意:王国里有n头恶龙,m个勇士,每个勇士有不同的能量值l[i],以击杀恶龙头直径d[j]小于l[i]的恶龙。
u011328934
·
2013-11-29 22:00
UVA -
11292
Dragon of Loowater
题意:有N条龙,M个骑士,一个能力值为X的骑士只能砍掉直径步超过X的龙,且要支付X个金币,求将所有龙杀死的最小金币,一个骑士只能杀死一个龙,分别排序#include #include #include #include usingnamespacestd; constintMAXN=20005; intn,m; intdra[MAXN],cost[MAXN]; intmain(){ while
u011345136
·
2013-11-22 19:00
UVA
11292
Dragon of Loowater
DragonofLoowaterTimeLimit: 1000MS MemoryLimit: Unknown 64bitIOFormat: %lld&%llu[Submit] [GoBack] [Status] DescriptionProblemC:TheDragonofLoowaterOnceuponatime,intheKingdomofLoowater,aminornuisancet
u012797220
·
2013-11-13 21:00
Algorithm
ACM
uva
(UVA step1)UVA
11292
The Dragon of Loowater(有n条恶龙,m个骑士,求杀死恶龙的最小代价)
/* *UVA_
11292
.cpp * *Createdon:2013年11月17日 *Author:Administrator */ #include #include #include usingnamespacestd
caihongshijie6
·
2013-10-25 16:00
UVA
11292
勇者斗恶龙
算法竞赛入门练习题……知道怎么做了,交了多次都不行,就一点点不一样,都过不了,而且是输出形式不太什么都过不了,终于感觉到了UVA的严谨了……#include #include #include #include usingnamespacestd; constintM=20005; inta[M],b[M]; intmain() { intn,m; while(scanf("%d%d",&n,&m
u011466175
·
2013-10-17 14:00
UVa
11292
/ POJ 3646 / HDU 1902 Dragon of Loowater (贪心)
11292
-DragonofLoowaterTimelimit:1.000secondshttp://uva.onlinejudge.org/index.php?
synapse7
·
2013-09-01 09:00
C++
ACM
poj
HDU
uva
UVA
11292
Dragon of Loowater
很简单的题目,今天开始训练指南之旅~一次AC嘻嘻。直接排序比较就可以了。#include #include usingnamespacestd; constintMAXN=20000+10; intdragon[MAXN],knight[MAXN]; intmain() { intn,m,i,j; while(cin>>n>>m,n||m) { for(i=0;i>dragon[i]; for(i
murmured
·
2013-07-22 10:00
UVA
11292
-The Dragon of Loowater
题意:给出龙的头数和头的数值,勇士的人数和需要用的钱,求出国王话费最少的钱才能将龙杀死,也可能杀不死思路:先将两个数组排序,然后进行比较就可以了#include #include #include #include usingnamespacestd; intmain(){ intn,m; while(scanf("%d%d",&n,&m)&&n&&m){ intarr1[20005],arr2
u011345461
·
2013-07-18 17:00
UVA
11292
The Dragon of Loowater 英文略长略长
UVA
11292
TheDragonofLoowater其实很水的。。。看题目花的时间比写的时间更久。
u011217342
·
2013-07-18 01:00
上一页
1
2
3
下一页
按字母分类:
A
B
C
D
E
F
G
H
I
J
K
L
M
N
O
P
Q
R
S
T
U
V
W
X
Y
Z
其他