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…
题目大意: 你的王国里有一条n个头的恶龙,你希望雇佣一些骑士把它杀死(即砍掉所有头).村里有m个骑士可以雇佣,一个能力值为x的骑士可以砍掉恶龙一个直径不超过x的头,且需要支付x个金币.如何雇佣骑士才能砍掉龙的所有头,且需要支付的金币最少?注意,一个骑士只能砍一个头.(且不能被雇佣两次). 输入格式 输入包含多组数据.每组数据的第一行为正整数n和m(1<=n,m<=20000):以下n行每行为一个整数,即恶龙每个头的直径:以下m行每行为一个整数,即每个骑士的能力.输入结束标志为n=m=0. 输出…
  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…
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…
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…