简单贪心

龙头的直径和人的佣金排序,价值小的人和直径小的配

 #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的更多相关文章

  1. UVA 11292 Dragon of Loowater(简单贪心)

    Problem C: The Dragon of Loowater Once upon a time, in the Kingdom of Loowater, a minor nuisance tur ...

  2. uva 11292 Dragon of Loowater (勇者斗恶龙)

    Problem C: The Dragon of Loowater Once upon a time, in the Kingdom of Loowater, a minor nuisance tur ...

  3. [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 ...

  4. UVa 11292 - Dragon of Loowater(排序贪心)

    Once upon a time, in the Kingdom of Loowater, a minor nuisance turned into a major problem.The shore ...

  5. UVA - 11292 Dragon of Loowater 贪心

    贪心策略:一个直径为X的头颅,应该让雇佣费用满足大于等于X且最小的骑士来砍掉,这样才能使得花费最少. AC代码 #include <cstdio> #include <cmath&g ...

  6. UVa 11292 Dragon of Loowater (水题,排序)

    题意:有n个条龙,在雇佣勇士去杀,每个勇士能力值为x,只能杀死头的直径y小于或等于自己能力值的龙,只能被雇佣一次,并且你要给x赏金,求最少的赏金. 析:很简单么,很明显,能力值高的杀直径大的,低的杀直 ...

  7. UVA它11292 - Dragon of Loowater

    Problem C: The Dragon of Loowater Once upon a time, in the Kingdom of Loowater, a minor nuisance tur ...

  8. 贪心/思维题 UVA 11292 The Dragon of Loowater

    题目传送门 /* 题意:n个头,m个士兵,问能否砍掉n个头 贪心/思维题:两个数组升序排序,用最弱的士兵砍掉当前的头 */ #include <cstdio> #include <c ...

  9. cogs 1405. 中古世界的恶龙[The Drangon of Loowater,UVa 11292]

    1405. 中古世界的恶龙[The Drangon of Loowater,UVa 11292] ★   输入文件:DragonUVa.in   输出文件:DragonUVa.out   简单对比时间 ...

随机推荐

  1. 01.Sencha ExtJS 6 - Generate Workspace and Application

    生成workspace         下载gpl版本的ExtJs6         在https://www.sencha.com/legal/GPL/页面的右侧申请链接来下载,或者使用链接http ...

  2. extjs ajax java简单精美验证码实现 有图

    前端:利用ExtJs的autoEl功能加载图片. var imgCheckValid = new Ext.create('Ext.Component',{ width: 70, //图片宽度 heig ...

  3. html 报表导出excel防止数字变科学计数

    在html 标签加:  <html xmlns:x="urn:schemas-microsoft-com:office:excel">    在要导出的tr加:  &l ...

  4. 开启gpu加速的高性能移动端相框组件!

    通过设置新的css3新属性translateX来代替传统的绝对定位改变left值的动画原理,新属性translateX会开启浏览器自带的gpu硬件加速动画性能,提高流畅度从而提高用户体验, 代码有很详 ...

  5. Android之RecyclerView(一)

    概述 RecyclerView 是一个 ViewGroup,它用于渲染任何基于适配器的 View.它被官方定义为 ListView 和 GridView 的取代者,是在 Support V7 包中引入 ...

  6. Java基础知识系列——日期

    日期类型也是在编程中经常用到的一种数据类型. Java中的日期类型为Date. 另外需要记住三个类: java.text.SimpleDateFormat; java.util.Calendar; j ...

  7. MVC中实现只有当用户登录成功的时候才等浏览内容,否则跳转到登录页面

    第一步,在登录的时候记录Session //提供Session接口方便后面判断用户登录 Session["UserInfo"] = uinfo;  //uInfo是用户登录Mode ...

  8. iOS中坐标转换

    坐标转换,可以用UIVIew的方法 //由要转换坐标view的superView执行该方法,rect为待转换view的frame,view是要显示到哪儿的 - (CGRect)convertRect: ...

  9. iOS工作笔记(十五)

    1.使用MJRefresh上拉加载的小细节 MJRefreshBackGifFooter *footer = [MJRefreshBackGifFooter footerWithRefreshingB ...

  10. poj 2761 Feed the dogs (treap树)

    /************************************************************* 题目: Feed the dogs(poj 2761) 链接: http: ...