# UVa-11292 - Dragon of Loowater:简单题

//UVa
#include<cstdio>
#include<ctype.h>
#include<cstring>
#include<fstream>
#include<iostream>
#include<algorithm>
#define LOCAL
using namespace std;
#define maxn 20005
int a[maxn],b[maxn];
int main()
{
#ifdef LOCAL
freopen("in.txt","r",stdin);
//freopen("out.txt","w",stdout);
#endif // LOCAL
int n,m;
while(scanf("%d%d",&n,&m)==2){
if(n==m&&n==0) break;
int i,j;
for(i=0; i<n; i++)
scanf("%d",&a[i]);
for(i=0; i<m; i++)
scanf("%d",&b[i]);
if(n>m){
printf("Loowater is doomed!\n");
continue;
}
sort(a,a+n);
sort(b,b+m);
int ans=0;
for(i=0,j=0; i<n&&j<m;){
if(a[i]<=b[j]){
ans+=b[j];
i++; j++;
}
else j++;
}
if(i==n)
printf("%d\n",ans);
else
printf("Loowater is doomed!\n");
}
return 0;
}


• 本文已收录于以下专栏：

## UVA 题目11292 Dragon of Loowater

Problem C: The Dragon of Loowater Once upon a time, in the Kingdom of Loowater, a minor nuisance tu...
• SJF0115
• 2013年04月19日 09:03
• 2232

## ACM——The Dragon of Loowater（UVa 11292）

ter had always been a primebreeding ground for geese. Due to the lack of predators, the geesepopulat...

## uva 11292 Dragon of Loowater （勇者斗恶龙系列）

uva 11292 Dragon of Loowate The Dragon of Loowater Once upon a time, in the Kingdom 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...

## UVa11292 The Dragon of Loowater(sort排序直接比较)

UVa11292The Dragon of Loowater(sort排序)

## 勇者斗恶龙(The Dragon of Loowater) UVa 11292 HDU 1902

Problem Description Once upon a time, in the Kingdom of Loowater, a minor nuisance turned into a ma...

## UVa 11292 / POJ 3646 / HDU 1902 Dragon of Loowater (贪心)

11292 - Dragon of Loowater Time limit: 1.000 seconds http://uva.onlinejudge.org/index.php?option=com...

举报原因： 您举报文章：UVa-11292 - Dragon of Loowater:简单题 色情 政治 抄袭 广告 招聘 骂人 其他 (最多只允许输入30个字)