POJ 3646 Dragon of Loowater
来源:互联网 发布:php图书管理系统实例 编辑:程序博客网 时间:2024/06/07 00:04
UVa 11292 /poj 3646 /hdu 1902
贪心~ 水题 !
太久没A题了,手生了,敲了半个小时。
#include <cstdio>#include <cstdlib>#include <algorithm>#include <iostream>using namespace std;int a[20005],b[20005];int main(){ //freopen("in.txt","r",stdin); int n,m; while(scanf("%d%d",&n,&m)) { if ( n == 0 || m == 0 ) break; for (int i=0;i<n;i++) scanf("%d",&a[i]); for (int i=0;i<m;i++) scanf("%d",&b[i]); if (n <= m){ sort(a,a+n); sort(b,b+m); int i=0,j=0; int count=0; int sum=0; for ( ;j<m; ) { if ( b[j] >= a[i] ) { count++;sum+=b[j];j++; if ( ++i == n) break; } else j++; } if ( count == n ) printf("%d\n",sum); else printf("Loowater is doomed!\n"); } else printf("Loowater is doomed!\n"); }}
- POJ 3646 Dragon of Loowater
- POJ 3646 Dragon of Loowater
- POJ-3646-The Dragon of Loowater
- poj 3646 The Dragon of Loowater!水!!
- POJ-3646 The Dragon of Loowater
- POJ 3646 The Dragon of Loowater
- POJ 3646 The Dragon of Loowater G++
- UVa 11292 / POJ 3646 / HDU 1902 Dragon of Loowater (贪心)
- 白皮书:The Dragon of Loowater, UVa 11292,POJ 3646
- poj 3646 The Dragon of Loowater 排序+贪心
- POJ - 3646 The Dragon of Loowater(贪心)
- 周赛 POJ 3546 The Dragon of Loowater
- uva11292 Dragon of Loowater
- UVA11292:Dragon of Loowater
- 11292 - Dragon of Loowater
- UVa11292 Dragon of Loowater
- uva11292 - Dragon of Loowater
- UVA11292-Dragon of Loowater
- HDU 3622 2-SAT+二分
- Android页面切换方法和区别
- C语言中类型转换时的截取规则及补码表示的计算方法
- Android 图片裁剪功能实现详解(类似QQ自定义头像裁剪)
- float和double类型精度表示的区别
- POJ 3646 Dragon of Loowater
- poj 2312
- Project Euler problem 21
- Android Activity生命周期2
- 关于Debug Assertion Failed!的一些问题 (转载)
- 理解ASM(六)ASM文件管理
- VC++写的一个最简单的工程项目
- Windows命令行指令
- Target runtime Apache Tomcat v5.0 is not defined 错误解决方法