UVa 11292 Dragon of Loowater
简单贪心
龙头的直径和人的佣金排序,价值小的人和直径小的配
#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;
while(scanf("%d%d",&n,&m)!=EOF){
if(n==&&m==)
break;
for(i=;i<=n;i++){
scanf("%d",&a[i]);
}
for(i=;i<=m;i++){
scanf("%d",&b[i]);
}
sort(a+,a++n);
sort(b+,b++m);
int ans=;
int t=;
for(i=;i<=m;i++){
if(b[i]>=a[t]){
ans=ans+b[i];
t++;
if(t-==n)
break;
}
}
if(t-<n)
printf("Loowater is doomed!\n");
else
printf("%d\n",ans);
}
}
UVa 11292 Dragon of Loowater的更多相关文章
- UVA 11292 Dragon of Loowater(简单贪心)
Problem C: The Dragon of Loowater Once upon a time, in the Kingdom of Loowater, a minor nuisance tur ...
- uva 11292 Dragon of Loowater (勇者斗恶龙)
Problem C: The Dragon of Loowater Once upon a time, in the Kingdom of Loowater, a minor nuisance tur ...
- [ACM_水题] UVA 11292 Dragon of Loowater [勇士斗恶龙 双数组排序 贪心]
Once upon a time, in the Kingdom of Loowater, a minor nuisance turned into a major problem. The shor ...
- UVa 11292 - Dragon of Loowater(排序贪心)
Once upon a time, in the Kingdom of Loowater, a minor nuisance turned into a major problem.The shore ...
- UVA - 11292 Dragon of Loowater 贪心
贪心策略:一个直径为X的头颅,应该让雇佣费用满足大于等于X且最小的骑士来砍掉,这样才能使得花费最少. AC代码 #include <cstdio> #include <cmath&g ...
- UVa 11292 Dragon of Loowater (水题,排序)
题意:有n个条龙,在雇佣勇士去杀,每个勇士能力值为x,只能杀死头的直径y小于或等于自己能力值的龙,只能被雇佣一次,并且你要给x赏金,求最少的赏金. 析:很简单么,很明显,能力值高的杀直径大的,低的杀直 ...
- UVA它11292 - Dragon of Loowater
Problem C: The Dragon of Loowater Once upon a time, in the Kingdom of Loowater, a minor nuisance tur ...
- 贪心/思维题 UVA 11292 The Dragon of Loowater
题目传送门 /* 题意:n个头,m个士兵,问能否砍掉n个头 贪心/思维题:两个数组升序排序,用最弱的士兵砍掉当前的头 */ #include <cstdio> #include <c ...
- cogs 1405. 中古世界的恶龙[The Drangon of Loowater,UVa 11292]
1405. 中古世界的恶龙[The Drangon of Loowater,UVa 11292] ★ 输入文件:DragonUVa.in 输出文件:DragonUVa.out 简单对比时间 ...
随机推荐
- http://www.360doc.com/content/13/0516/22/12094763_285956121.shtml
http://www.360doc.com/content/13/0516/22/12094763_285956121.shtml
- Office 365 系列三 ------ 创建Office 365普通账号
当我们购买或者试用Office 365的时候,微软或者世纪互联会发一封邮件给我们,里面就只有管理员的账号,那么作为我们IT 管理员应该给员工创建账号, 创建的过程如下: 一.登陆: http://po ...
- Docker 不能被外网正常访问
问题描述: 1. docker容器不能 被外部网络正常访问 2. docker所在服务器可以正常访问 3. docker启动时 报 ip_forward 错误 ARNING: IPv4 forward ...
- OAF 中的EO 和VO
EO :oracle.apps.fnd.framework.server.OAEntityImpl VO:oracle.apps.fnd.framework.server.OAViewRowImpl ...
- 【Python全栈笔记】03 [模块二] 16-17 Oct 函数
定义一个函数 def function_name(形式参数): 代码块 return 'Value' #如果没有写return,则默认返回None # 一个函数到return这一行就结束执行了,在re ...
- 驱动开发学习笔记. 0.05 linux 2.6 platform device register 平台设备注册 2/2 共2篇
驱动开发读书笔记. 0.05 linux 2.6 platform device register 平台设备注册 2/2 共2篇 下面这段摘自 linux源码里面的文档 : 内核版本2.6.22Doc ...
- Xml与DataTable相互转换方法
1.Xml与DataTable相互转换方法:http://www.cnblogs.com/lilin/archive/2010/04/18/1714927.html
- SQL基本语句以及示例
基本语句: /*dorp colunm*/ 语法:ALTER TABLE 表名 DROP COLUMN 要删除的字段 验证财务转换的正确性,查询以下两个表是否有数据 /*表连接inner jion ...
- sql server 分页存储过程
----------------------分页存储过程------------------------------------------------------------------------ ...
- scp详解
scp 命令 ================== scp 可以在 2个 linux 主机间复制文件: 命令基本格式: scp [可选参数] file_source file_targe ...