Dragon of Loowater(贪心)
来源:互联网 发布:java 绘图无法显示 编辑:程序博客网 时间:2024/05/22 13:28
题意:
聘请能力值大于等于恶龙的骑士杀恶龙,按照能力值付金币,使金币尽量少.水题,一键sort.
#include<iostream>#include<cstdio>#include<algorithm>using namespace std;int dra[20005];int kni[20005];int n, m;int main() {while(scanf("%d%d", &n, &m) != EOF && n && m) {for(int i=0; i<n; i++)scanf("%d", &dra[i]);for(int j=0; j<m; j++) scanf("%d", &kni[j]);sort(dra, dra+n); sort(kni, kni+m);if(n>m) {printf("Loowater is doomed!\n");continue;}int i, j, sum=0;for( i=0,j=0; i<n&&j<m; j++) {if(dra[i] <= kni[j]) {i++;sum += kni[j];}}if(i==n) printf("%d\n", sum);else printf("Loowater is doomed!\n");}return 0;}
0 0
- 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 【贪心】
- 11292 - Dragon of Loowater(贪心)
- HDOJ 1902 The Dragon of Loowater【贪心】
- uva11292 - The Dragon of Loowater (贪心)
- UVa Dragon of Loowater 11292 (贪心)
- UVa 11292 - Dragon of Loowater(排序贪心)
- UVa - 11292 - The Dragon of Loowater ( 贪心 )
- HDU 1902 The Dragon of Loowater 贪心
- UVA 11292 Dragon of Loowater(贪心)
- UVA 11292 Dragon of Loowater 贪心 .
- UVa - 11292 - Dragon of Loowater ( 排序 + 贪心 )
- UVA.11292 Dragon of Loowater (贪心)
- IFrame 加载网页完成事件
- 高性能服务器架构
- Android中跳转到系统设置界面大全
- windows下无GPU的caffe的配置
- istream_iterator ostream_iterator 迭代器和IO
- Dragon of Loowater(贪心)
- Error:.exe has triggered a breakpoint.
- bat批处理笔记——为指定类型文件添加前缀名
- 简单的 数据加载显示“数据正在加载,请稍后”
- 什么是排序算法的稳定性
- HttpContext.Current.Session 为null
- 转载:Markdown 11种基本语法
- Android中asset文件夹和raw文件夹区别与用法
- 10条命令,一分钟分析Linux性能问题