# Uva 11292 Dragon of Loowater - 水题

#include <stdio.h>
#include <string.h>
#include <algorithm>
using namespace std;

const int maxn = 20005;
int dra[maxn];
int kni[maxn];
int n,m;
int main()
{
while(scanf("%d%d",&n,&m) && n != 0 && m != 0) {
for(int i = 0; i < n; i++) {
scanf("%d",&dra[i]);
}
for(int i = 0; i < m; i++) {
scanf("%d",&kni[i]);
}
sort(dra,dra+n);
sort(kni,kni+m);
int i,j = 0;
int ans = 0;
for(i = 0; i < n && j < m; i++) {
while(j < m && kni[j] <  dra[i]) {
j++;
}
if(j == m) break;
ans += kni[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 tur...

## UVa 11292 - Dragon of Loowater

Once upon a time, in theKingdom of Loowater, a minor nuisance turned into a major problem. The sho...

## 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 Dragon of Loowater

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

## 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（贪心）

举报原因： 您举报文章：深度学习：神经网络中的前向传播和反向传播算法推导 色情 政治 抄袭 广告 招聘 骂人 其他 (最多只允许输入30个字)