sicily 1459. The Dragon of Loowater】的更多相关文章

        Time Limit: 1sec    Memory Limit:32MB  Description 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 geese. D…
  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 breeding ground for geese. Due to the lack of predators, the g…
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 breeding ground for geese. Due to the lack of predato…
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 breeding ground for geese. Due to the lack of predato…
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 breeding ground for geese. Due to the lack of predato…
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 breeding ground for geese. Due to the lack of predato…
option=com_onlinejudge&Itemid=8&page=show_problem&problem=2267" style="color:blue; text-decoration:none">Dragon of Loowater Time Limit: 1000MS   Memory Limit: Unknown   64bit IO Format: %lld & %llu [Submit]   [Go Back]  …
题目传送门 /* 题意:n个头,m个士兵,问能否砍掉n个头 贪心/思维题:两个数组升序排序,用最弱的士兵砍掉当前的头 */ #include <cstdio> #include <cstring> #include <algorithm> using namespace std; ; const int INF = 0x3f3f3f3f; int a[MAXN], b[MAXN]; int main(void) //UVA 11292 The Dragon of Loo…
---恢复内容开始--- 题目: 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 geese. Due to the lack of predators, the geese pop…
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 geese. Due to the lack of predators, the geese population was out o…
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 geese.Due to the lack of predators,the geese population was out of c…
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 geese. Due to the lack of predators, the geese population was out o…
https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=24&page=show_problem&problem=2267 有一条n个头的恶龙,现在有m个骑士可以雇佣去杀死他,一个能力值为x的勇士可以砍掉直径不超过x的头,而且需要支付x个金币.如何雇佣才能砍掉所有的头且支付最少的金币,注意一个勇士只能砍一个头,也只能被雇佣一次. 输入包含多组数据,每组数据第一行为正整数n,…
水题,排序遍历即可 #include<iostream> #include<cstdio> #include<algorithm> using namespace std; ; int drag[maxn], kn[maxn]; int main() { int n, m, cost; while (cin >> n >> m) { && m == )break; ;i < n;i++)cin >> drag[i…
简单贪心 龙头的直径和人的佣金排序,价值小的人和直径小的配 #include<iostream> #include<cstdio> #include<cmath> #include<cstring> #include<algorithm> typedef long long ll; #define N 20005 using namespace std; int a[N],b[N]; int main(){ int m,n; int i,j; w…
你的王国里有一条n个头的恶龙,你希望雇佣一些骑士把它杀死(也就是砍掉所有的头).村里有m个骑士可以雇佣,一个能力值为 x 的骑士可以砍掉恶龙一个直径不超过 x 的头,且需要支付 x 个金币.如何雇佣骑士才能砍掉恶龙所有的头,并且支付最小的金币?注意,一个骑士只能砍一个头并且仅能被雇佣1次 因为要保证用的钱最少,所以先把骑士按照能力值从小到大进行排序.然后从最小的开始一个一个进行匹配.在进行匹配的时候又出现一个问题,那就是每个骑士只能雇佣一次.这里有2个处理方法,第一个是开一个数组用来标记该骑士是…
http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=24&page=show_problem&problem=2267 题目大意:n条恶龙,m个勇士,用勇士来杀恶龙.一个勇士只能杀一个恶龙.而且勇士只能杀直径不超过自己能力值的恶龙.每个勇士需要支付能力值一样的金币.问杀掉所有恶龙需要的最少金币? 题意分析:先排序,再进行筛选. #include<stdio.h>…
贪心策略:一个直径为X的头颅,应该让雇佣费用满足大于等于X且最小的骑士来砍掉,这样才能使得花费最少. AC代码 #include <cstdio> #include <cmath> #include <algorithm> #include <cstring> #include <utility> #include <string> #include <iostream> #include <map> #inc…
题意:有n个条龙,在雇佣勇士去杀,每个勇士能力值为x,只能杀死头的直径y小于或等于自己能力值的龙,只能被雇佣一次,并且你要给x赏金,求最少的赏金. 析:很简单么,很明显,能力值高的杀直径大的,低的杀直径小的.所以我们先对勇士能力值从小到大排序,然后对龙的直径从小到大排序, 然后扫一遍即可,如某个勇士杀不龙,就可以跳过,扫到最后,如果杀完了就结束,输出费用,否则就是杀不完. 代码如下: #include <iostream> #include <cstdio> #include &l…
题目大意: 你的王国里有一条n个头的恶龙,你希望雇佣一些骑士把它杀死(即砍掉所有头).村里有m个骑士可以雇佣,一个能力值为x的骑士可以砍掉恶龙一个直径不超过x的头,且需要支付x个金币.如何雇佣骑士才能砍掉龙的所有头,且需要支付的金币最少?注意,一个骑士只能砍一个头.(且不能被雇佣两次). 输入格式 输入包含多组数据.每组数据的第一行为正整数n和m(1<=n,m<=20000):以下n行每行为一个整数,即恶龙每个头的直径:以下m行每行为一个整数,即每个骑士的能力.输入结束标志为n=m=0. 输出…
#include<iostream> #include<cstdio> #include<cstdlib> #include<cstring> #include<string> #include<cmath> #include<map> #include<set> #include<vector> #include<algorithm> #include<stack> #in…
首先先看一下这道题的英文原版... 好吧,没看懂... 大体意思就是: 有一条n个头的恶龙,现在有m个骑士可以雇佣去杀死他,一个能力值为x的勇士可以砍掉直径不超过x的头,而且需要支付x个金币.如何雇佣才能砍掉所有的头且支付最少的金币,注意一个勇士只能砍一个头,也只能被雇佣一次. 输入包含多组数据,每组数据第一行为正整数n,m(1<=n,m<=20000),以下n行每行为一个整数,就是恶龙的头的直径,以下m行每行为一个整数,就是每个骑士的能力值.输入结束标志位m=n=0. 输出格式对于每组数据输…
题目大意:   你的王国里有一条n个头的恶龙,你希望雇一些骑士把它杀死(即砍掉所有头).村里有m个骑士可以雇佣,一个能力值为x的骑士可以砍掉恶龙一个直径不超过x的头,且需要支付x个金币.如何雇佣骑士才能砍掉恶龙的所有头,且需要支付的金币最少?注意,一个骑士只能砍一个头(且不能被雇佣两次).  输入格式 输入包含多组数据.每组数据的第一行为正整数n和m(1≤n,m≤20 000):以下n行每行为一个整数,即恶龙每个头的直径:以下m行每行为一个整数,即每个骑士的能力.输入结束标志为n=m=0. 输出…
题意:有一条有n个头的恶龙,有m个骑士去砍掉它们的头,每个骑士可以砍直径不超过x的头,问怎样雇佣骑士,使花的钱最少 把头的直径从小到大排序,骑士的能力值也从小到大排序,再一个一个地去砍头 #include<iostream> #include<cstdio> #include<cstring> #include <cmath> #include<stack> #include<vector> #include<map> #…
/* 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 breeding ground for geese. Due to the lack of predators, the…
1405. 中古世界的恶龙[The Drangon of Loowater,UVa 11292] ★   输入文件:DragonUVa.in   输出文件:DragonUVa.out   简单对比时间限制:1 s   内存限制:256 MB [题目描述] King(CH)的王国里有一条n个头的恶龙,他希望雇佣一些骑士把它杀死(即砍掉所有的头).小酒馆里有m个骑士可以雇佣,一个能力值为x的骑士可以砍掉一个直径不超过x的头,且需要支付x个金币.如何雇用骑士才能砍掉所有恶龙的头,且需要支付的金币最少?…
各种杂题,水题,模拟,包括简单数论. 1001 A+B 1002 A+B+C 1009 Fat Cat 1010 The Angle 1011 Unix ls 1012 Decoding Task 1019 Grandpa's Other Estate 1034 Simple Arithmetics 1036 Complete the sequence! 1043 Maya Calendar 1054 Game Prediction 1057 Mileage Bank 1067 Rails 10…
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 breeding ground for geese. Due to the lack of predato…
直接用白书上的翻译吧 例题1  勇者斗恶龙(The Dragon of Loowater, UVa 11292) 你的王国里有一条n个头的恶龙,你希望雇一些骑士把它杀死(即砍掉所有头).村里有m个骑士可以雇佣,一个能力值为x的骑士可以砍掉恶龙一个直径不超过x的头,且需要支付x个金币.如何雇佣骑士才能砍掉恶龙的所有头,且需要支付的金币最少?注意,一个骑士只能砍一个头(且不能被雇佣两次). [输入格式] 输入包含多组数据.每组数据的第一行为正整数n和m(1≤n,m≤20 000):以下n行每行为一个…
***从今天开始自学算法. ***代码是用c++,所以顺便再自学一下c++ 例题1  勇者斗恶龙(The Dragon of Loowater, UVa 11292) 你的王国里有一条n个头的恶龙,你希望雇一些骑士把它杀死(即砍掉所有头).村里有m个骑士可以雇佣,一个能力值为x的骑士可以砍掉恶龙一个直径不超过x的头,且需要支付x个金币.如何雇佣骑士才能砍掉恶龙的所有头,且需要支付的金币最少?注意,一个骑士只能砍一个头(且不能被雇佣两次). [输入格式] 输入包含多组数据.每组数据的第一行为正整数…