UVA11292
来源:互联网 发布:邮币卡交易软件 编辑:程序博客网 时间:2024/05/16 12:21
#pragma warning(disable:4996)#include<cstdio>#include<cstring>#include<string>#include<cmath>#include<vector>#include<algorithm>#include<iostream>#include<time.h>using namespace std;int a[20005];int b[20005];int main(){ int n, m; while (cin >> n >> m) { memset(a, 0, sizeof(a)); memset(b, 0, sizeof(b)); if (n == 0 && m == 0) { return 0; } else { for (int i = 1; i <= n; i++) { cin >> a[i]; } for (int i = 1; i <= m; i++) { cin >> b[i]; } sort(a+1,a+n+1); sort(b+1,b+m+1); int sum = 0; if (m < n) { printf("Loowater is doomed!\n"); } else { int i, j; int flag = 0; int temp = 1; for (i = 1; i <= n; i++) { for (j = temp; j <= m; j++) { if (a[i] <= b[j]) { sum += b[j]; temp = j + 1; break; } } if (j == m&&i != n) { flag = 1; break; } } if (flag) { printf("Loowater is doomed!\n"); } else { printf("%d\n", sum); } } } } return 0;}
0 0
- UVA11292
- UVa11292
- UVa11292
- uva11292
- uva11292
- UVa11292
- Uva11292
- UVA11292
- UVa11292
- UVA11292
- UVa11292
- UVa11292
- UVA11292杀怪
- uva11292--贪心
- uva11292 Dragon of Loowater
- UVA11292:Dragon of Loowater
- UVa11292 Dragon of Loowater
- uva11292 - Dragon of Loowater
- IE8 console未定义
- LeetCode292. Nim Game
- JSP图片验证码
- 图像处理理论(三)——双边滤波, Steerable滤波, Gabor滤波, Schmid滤波
- Mysql与其他数据库的简单比较
- UVA11292
- web dynpro配置注意事项
- 99%的人都理解错了HTTP中GET与POST的区别
- 构建新的 App 和 App 更新时,必须使用公共(GM)版 Xcode 6 或更高版本、OS X 以及 iOS SDK。请勿提交使用 Beta 版软件,包括 Beta 版 OS X 构建的 App。
- Java中的JavaCore/HeapDump文件及其分析方法(很重要)
- linux 进程前台/后台切换
- heritrix网络爬虫存储路径设置
- 数据库简单建立
- iOS 设备唯一标示