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
Loowater
UVa11292 - Dragon of
Loowater
(贪心)
题意:有一个恶龙有n个头,n个头在不同的高度,m个武士,武士只能砍到比它矮的头,而雇佣武士的费用就是武士的高度值,要求以最少的费用来杀到这条恶龙。思路:在砍一个头时,总是选取比这个头高度大但是在武士身高中最小的。代码如下:#include#include#include#includeusingnamespacestd;classSolution{public:voidtragonOfLoowat
kgduu
·
2023-08-20 08:26
训练指南
OJ
11292 - Dragon of
Loowater
(贪心)
我的《训练指南》第一题,开始刷训练指南了,接下来会踏踏实实的独立刷题,远离题解。例题也尽量自己做。刷题的内容大致就是lrj的两本书和另外的训练题。其他的题库待我能力达到了再说吧。该题很简单,排序、贪心即可。很容易证明选厉害的骑士不如选差一点的好。细节参见代码:#includeusingnamespacestd;constintmaxn=20000+5;intn,m,head[maxn],knigh
AC_Arthur
·
2020-08-23 03:38
uva解题报告
高效算法
UVA它11292 - Dragon of
Loowater
ProblemC:TheDragonofLoowaterOnceuponatime,intheKingdomofLoowater,aminornuisanceturnedintoamajorproblem.TheshoresofRellauCreekincentralLoowaterhadalwaysbeenaprimebreedinggroundforgeese.Duetothelackofpr
weixin_30387799
·
2020-08-23 03:47
UVA - 11292 - Dragon of
Loowater
http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=24&page=show_problem&problem=2267题意:输入Dragon数组和Knight数组,Knight比Dragon大时付款,计算出最小的总付款值。解题:普通的模拟水题,回来没事动动脑子。再不动脑就要生锈啦!先使用qsor
slashXX_xu
·
2020-08-23 03:16
UVA
Uva11292 The Dragon of
Loowater
Onceuponatime,intheKingdomofLoowater,aminornuisanceturnedintoamajorproblem.TheshoresofRellauCreekincentralLoowaterhadalwaysbeenaprimebreedinggroundforgeese.Duetothelackofpredators,thegeesepopulationwa
hentaidesu
·
2020-08-23 01:26
ACM
UVA
ACM UVA 11292 - Dragon of
Loowater
ProblemC:TheDragonofLoowaterOnceuponatime,intheKingdomofLoowater,aminornuisanceturnedintoamajorproblem.TheshoresofRellauCreekincentralLoowaterhadalwaysbeenaprimebreedinggroundforgeese.Duetothelackofpr
fangcunx
·
2020-08-23 00:42
贪心
uva
UVa 11292 - The Dragon of
Loowater
AOAPCI:BeginningAlgorithmContests(RujiaLiu)::Volume1.ElementaryProblemSolving::Sorting/SearchingDescription待编辑TypeSorting/SearchingAnalysis利用STL,轻松加愉快。Solution//UVaOJ755//487--3279//byACodeRabbit#incl
Ra_WinDing
·
2020-08-02 17:00
ICPC-report
uva --11292 --Dragon of
Loowater
无需多言,上代码~~~~~~inta[maxn],b[maxn];intn,m;boolinit(){scanf("%d%d",&n,&m);if(n+m==0)returnfalse;returntrue;}voidslove(){intcost=0;for(inti=0;im){cout=a[cnt]){cost+=b[i];cnt++;if(cnt==n)break;}}if(cnt
ZhouMu
·
2020-07-06 12:15
uva
Dragon of
Loowater
UVA - 11292
问题C:
Loowater
之龙曾几何时,在
Loowater
王国,轻微的滋扰变成了一个主要问题。位于
Loowater
中部的RellauCreek海岸一直是鹅的主要繁殖地。由于缺乏捕食者,鹅群失控。
fffzlfk
·
2020-07-06 04:52
C++
UVa 11292 - Dragon of
Loowater
(排序贪心)
Onceuponatime,intheKingdomofLoowater,aminornuisanceturnedintoamajorproblem.TheshoresofRellauCreekincentralLoowaterhadalwaysbeenaprimebreedinggroundforgeese.Duetothelackofpredators,thegeesepopulationwa
weixin_33979745
·
2020-07-05 23:21
金币能力UVA11292:Dragon of
Loowater
每日一贴,今天的内容关键字为金币能力题意:恶龙有n个头,每个头直径x,国王可以雇佣m个骑士,每个骑士能力为y,能砍半径y的头,雇佣金为y,不能重复雇佣,问最少能消费多少金币思路:对两者停止排序,然后停止比拟相加便可每日一道理闷热的天,蝉儿耐不住寂寞地不停在鸣叫,我孤单一人,寂静的身旁没有一个知音,想疯狂地听摇滚乐,听歇斯底里的歌声,那只为逃避无人的世界里那浓烈的孤单气息。一个人是清冷,两个人便是精
weixin_33786077
·
2020-07-05 23:51
UVa-11292 Dragon of
Loowater
(贪心)
题目链接题意:你的王国里一条n个头的恶龙,你希望雇佣一些骑士砍掉他的所有头,村里有m个骑士可以雇佣,一个能力值为x的骑士可以砍掉恶龙一个直径不超过x的头,且需要支付x个金币,如何雇用骑士才能砍掉恶龙的所有头,且需要支付的金币最少?注意,一个骑士只能砍一个头(且不能被雇用两次)输入:第一行为正整数n和m接下来n行,每行为一个整数,即恶龙每个头的直径接下来m行,每行为一个整数,即每个骑士的能力。思路:
走钢索的人Secret
·
2020-07-05 06:08
贪心算法
UVA11292 The Dragon of
Loowater
#include#include#include#defineM(a)memset(a,0,sizeof(a))usingnamespacestd;constintmaxn=20000+10;inthead[maxn],knight[maxn];intmain(){intn,m;while(scanf("%d%d",&n,&m)==2&&n&&m){longlongans=0;M(head);M(
以负熵为食
·
2020-07-05 02:37
UVA
贪心
UVA 11292(Dragon of
Loowater
-勇者斗恶龙)
ProblemC:TheDragonofLoowaterOnceuponatime,intheKingdomofLoowater,aminornuisanceturnedintoamajorproblem.TheshoresofRellauCreekincentralLoowaterhadalwaysbeenaprimebreedinggroundforgeese.Duetothelackofpr
nike0good
·
2020-07-05 01:06
贪心
uva11292-Dragon of
Loowater
#includeusingnamespacestd;#include#include#include#includeconstintmaxn=20005;inta[maxn];intb[maxn];boolused[maxn];intmain(){intn,m;while(scanf("%d%d",&n,&m)!=-1){if(n==0&&m==0)break;for(inti=0;im){jud
mymilkbottles
·
2020-07-05 00:37
ACM_YY
UVA - 11292 Dragon of
Loowater
( 排序 贪心 )
//思路:先将表示龙头的数组head和表示雇佣骑士所需金币的数组coin都进行排序,之后,从最小的龙头开始,每次贪心选取可以砍下当前龙头,且所需金币最少的骑士,每次砍下龙头后,更新当前以砍下的龙头总数cut,最后判断cut是否与龙头总数head相等#include#include#definerep(i,k,n)for(inti=k;i>n>>m&&n&&m){rep(i,0,n)cin>>hea
旷野虽远
·
2020-07-05 00:29
UVa
oj
Dragon of
Loowater
UVA - 11292(机智)
题目大意:国王招募勇士杀有N个头的恶龙。勇士有自己的身高X。恶龙的头也有高度。每个勇士可以砍掉恶龙的一个头当且仅当勇士的身高大于恶龙头的高度。身高为X的勇士需要X的金币数。现在在M个勇士中选出N个去屠龙,要求金币尽量少。题目链接:https://vjudge.net/problem/UVA-11292题目分析:因为要保证金币最少,那我们砍掉一个恶龙头的那个勇士的身高应该是所有身高大于这个头的勇士中
lwgkzl
·
2020-07-04 23:58
贪心
Dragon of
Loowater
UVA - 11292 (思维的体操)
Onceuponatime,intheKingdomofLoowater,aminornuisanceturnedintoamajorproblem.TheshoresofRellauCreekincentralLoowaterhadalwaysbeenaprimebreedinggroundforgeese.Duetothelackofpredators,thegeesepopulationwa
jinduo16
·
2020-07-04 19:31
ACM
UVa11292-Dragon of
Loowater
用两个优先队列维护龙头的直径和骑士的高度,不断从队列中抛出元素,第一个满足条件的即为最小的。#include#includeusingnamespacestd;intmain(intargc,charconst*argv[]){intn,m;while(scanf("%d%d",&n,&m)==2&&n+m){priority_queue,greater>head,knight;for(inti=
stdwal
·
2020-07-04 09:37
UVa
优先队列和堆
UVA之11292 - Dragon of
Loowater
ProblemC:TheDragonofLoowaterOnceuponatime,intheKingdomofLoowater,aminornuisanceturnedintoamajorproblem.TheshoresofRellauCreekincentralLoowaterhadalwaysbeenaprimebreedinggroundforgeese.Duetothelackofpr
SunnyYoona
·
2020-07-04 08:40
UVA
ACM-UVA
UVa11292_The Dragon of
Loowater
[java]
【题目】:你的王国里有一条n个头的恶龙,你希望雇一些骑士把它杀死(即砍掉所有头)。村里有m个骑士可以雇佣,一个能力值为x的骑士可以砍掉恶龙一个直径不超过x的头,且需要支付x个金币。如何雇佣骑士才能砍掉恶龙的所有头,且需要支付的金币最少?注意,一个骑士只能砍一个头(且不能被雇佣两次)。【输入格式】输入包含多组数据。每组数据的第一行为正整数n和m(1≤n,m≤20000);以下n行每行为一个整数,即恶
Parasol5
·
2020-07-04 07:28
ACM
uva11292 The Dragon of
Loowater
(排序+贪心)
题意:国王要杀恶龙,需要雇佣骑士。每个骑士只能杀一条龙。当骑士身高不小于龙头时,骑士可以砍下龙头。雇佣骑士需要钱,钱就等于他的身高。如果骑士能成功砍下所有的龙头,则输出雇佣总费最少的数值,否则输出那句鸟语。思路:排序+贪心。先把龙头跟骑士身高各自从小到大排序,然后从头到尾比较。若能砍下则雇佣,否则用下一个骑士。直到龙头砍完,或者骑士用完。教训:英语差,看到一只鸭子就怕。表示怒了,画只鸭子搞什么。好
MistKafka
·
2020-07-04 07:58
贪心
勇者斗恶龙(The Dragon of
Loowater
, UVa 11292)
勇者斗恶龙(TheDragonofLoowater,UVa11292)你的王国里有一条n个头的恶龙,你希望雇一些骑士把它杀死(即砍掉所有头)。村里有m个骑士可以雇佣,一个能力值为x的骑士可以砍掉恶龙一个直径不超过x的头,且需要支付x个金币。如何雇佣骑士才能砍掉恶龙的所有头,且需要支付的金币最少?注意,一个骑士只能砍一个头(且不能被雇佣两次)。【输入格式】输入包含多组数据。每组数据的第一行为正整数n
fancie_wong
·
2020-07-04 05:27
算法
UVA - 11292:Dragon of
Loowater
DragonofLoowater来源:UVA标签:排序,贪心算法参考资料:相似题目:题目Onceuponatime,intheKingdomofLoowater,aminornuisanceturnedintoamajorproblem.TheshoresofRellauCreekincentralLoowaterhadalwaysbeenaprimebreedinggroundforgeese.
wingrez
·
2018-09-03 22:36
【记录】算法题解
UVa 11292 Dragon of
Loowater
11292-DragonofLoowaterTimelimit:1.000secondsOnceuponatime,intheKingdomofLoowater,aminornuisanceturnedintoamajorproblem.TheshoresofRellauCreekincentralLoowaterhadalwaysbeenaprimebreedinggroundforgeese.
Cqh_i
·
2018-04-21 10:06
UVa
lrj-大白
UVA_11292_Dragon of
Loowater
#include #include #include #include #include #include #include #include #include #include #pragmawarning(disable:4996) #include #include usingstd::cin; usingstd::cout; usingstd::endl; usingstd::string
cxy7tv
·
2016-04-26 15:00
uva
greedy
hdu 1902 The Dragon of
Loowater
TheDragonofLoowaterTimeLimit:1000/1000MS(Java/Others) MemoryLimit:32768/32768K(Java/Others)TotalSubmission(s):1114 AcceptedSubmission(s):491ProblemDescriptionOnceuponatime,intheKingdomofLoowater
LeeHolmes
·
2016-04-17 12:00
HDU
贪心
UVa 11292&HDU1902 The Dragon of
Loowater
(贪心)
TheDragonofLoowaterTimeLimit:1000/1000MS(Java/Others) MemoryLimit:32768/32768K(Java/Others)TotalSubmission(s):1113 AcceptedSubmission(s):490ProblemDescriptionOnceuponatime,intheKingdomofLoowater
hurmishine
·
2016-04-04 17:00
of
dragon
the
UVa11292
HDU1902
Loowat
uva11292-Dragon of
Loowater
#include usingnamespacestd; #include #include #include #include constintmaxn=20005; inta[maxn]; intb[maxn]; boolused[maxn]; intmain(){ intn,m; while(scanf("%d%d",&n,&m)!=-1){ if(n==0&&m==0)break; fo
mymilkbottles
·
2016-03-29 21:00
UVA 11292 水题
问,如何用最小的费用来雇佣勇士,并且能杀完龙,如果不能就输出
loowater
...sort一下暴力就好了#include#include#includeusingnamespacestd;constintmaxn
zcj5027
·
2016-03-25 19:00
UVA 11292(p1)----The Dragon of
Loowater
#include usingnamespacestd; constintmaxn=20000+50; intn,m,ans,now; inthero[maxn]; intdragon[maxn]; intmain() { while(scanf("%d%d",&n,&m)==2&&n) { ans=0; now=0; for(inti=0;i=dragon[now]) { now++; ans+=
wang2147483647
·
2016-02-28 19:00
【UVa】11292 - Dragon of
Loowater
ProblemOnceuponatime,intheKingdomofLoowater,aminornuisanceturnedintoamajorproblem.TheshoresofRellauCreekincentralLoowaterhadalwaysbeenaprimebreedinggroundforgeese.Duetothelackofpredators,thegeesepopul
LeongHouHeng
·
2016-02-28 01:00
uva
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
金币能力UVA11292:Dragon of
Loowater
每日一贴,今天的内容关键字为金币能力 题意:恶龙有n个头,每个头直径x,国王可以雇佣m个骑士,每个骑士能力为y,能砍半径y的头,雇佣金为y,不能重复雇佣,问最少能消费多少金币 思路:对两者停止排序,然后停止比拟相加便可 每日一道理
·
2015-11-13 08:56
water
UVA11292 - Dragon of
Loowater
nbsp; Problem C: The Dragon of
Loowater
·
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
·
2015-11-11 19:08
water
学编程,学单词.....在学习中积累自己的单词(不断更新__ing)
Loowater
厕所水
·
2015-11-11 19:07
编程
贪心/思维题 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 UVa11292 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
·
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
uva11292Dragon 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
·
2015-11-01 12:00
water
《算法竞赛入门经典——训练指南》第一章相关内容
问题求解策略 (General Problem Solving Techniques) 例题 (Examples) 例题 1 UVa11292 The Dragon of
Loowater
·
2015-10-31 17:50
算法
UVA 11292 Dragon of
Loowater
O - Dragon of
Loowater
Time Limit:1000MS Memory Limit:0KB 64bit IO Format:%lld & %llu Submit
·
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
·
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
·
2015-10-31 11:36
water
上一页
1
2
下一页
按字母分类:
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
其他