UVa 11292 Dragon of Loowater——思路题
来源:互联网 发布:店面装修设计网站 知乎 编辑:程序博客网 时间:2024/06/05 23:02
#include <cstdio>#include <cstring>#include <iostream>#include <algorithm>using namespace std;const int maxn = 20000 + 10;int a[maxn], b[maxn];int main(){ int n, m; while (scanf("%d %d", &n, &m) == 2 && n + m) { for (int i = 1; i <= n; i++) scanf("%d", &a[i]); for (int i = 1; i <= m; i++) scanf("%d", &b[i]); sort(a + 1, a + 1 + n); sort(b + 1, b + 1 + m); int i, j = 1, ans = 0; for (int i = 1; i <= m; i++) { if (b[i] >= a[j]) { j++; ans += b[i]; if (j > n) break; } } if (j > n) printf("%d\n", ans); else printf("Loowater is doomed!\n"); }}
阅读全文
1 0
- UVa 11292 Dragon of Loowater——思路题
- UVa-11292 - Dragon of Loowater:简单题
- ACM——The Dragon of Loowater(UVa 11292)
- uva 11292 ——The Dragon of Loowater
- uva --11292 --Dragon of Loowater
- UVa 11292 - Dragon of Loowater
- uva - 11292 - Dragon of Loowater
- UVA 11292 - Dragon of Loowater
- uva 11292 - Dragon of Loowater
- Uva-11292-Dragon of Loowater
- UVA 11292 - Dragon of Loowater
- UVA 11292 Dragon of Loowater
- uva 11292 - Dragon of Loowater
- UVA 11292 - Dragon of Loowater
- UVA 11292 Dragon of Loowater
- UVA 11292 Dragon of Loowater
- UVa 11292 Dragon of Loowater
- UVa 11292 Dragon of Loowater
- A+B的问题
- 了解ActiveMQ
- 自己运动的方块(JS)
- 2017年蓝桥杯湖北省B组 错题总结
- Python创建二维数组
- UVa 11292 Dragon of Loowater——思路题
- jQuery选择器之内容筛选选择器
- python中判断list是否为空
- redis五大类型数据用法
- Gradle之使用BuildConfig自定义常量
- Apache POI 导出Excel笔记
- js进制转换问题
- CUDA内存类型memory
- Maven中使用Profile和filtering进行属性过滤