UVA 11292 勇者斗恶龙
来源:互联网 发布:网络计划的绘制规则 编辑:程序博客网 时间:2024/04/30 03:41
算法竞赛入门练习题……知道怎么做了,交了多次都不行,就一点点不一样,都过不了,而且是输出形式不太什么都过不了,终于感觉到了UVA的严谨了……
#include <iostream>#include <cstdio>#include <cstring>#include <algorithm>using namespace std;const int M=20005;int a[M],b[M];int main(){ int n,m; while(scanf("%d%d",&n,&m)&&n&&m) { int i,j=0,sum=0; for(i=0;i<n;i++) scanf("%d",&a[i]); for(i=0;i<m;i++) scanf("%d",&b[i]); sort(a,a+n); sort(b,b+m); for(i=0;i<m;i++) if(b[i]>=a[j]) { sum+=b[i]; if(++j==n) break; } if(j<n) printf("Loowater is doomed!\n"); else printf("%d\n",sum); } return 0;}
- UVA 11292 勇者斗恶龙
- UVA 11292 勇者斗恶龙
- uva 11292 勇者斗恶龙
- 勇者斗恶龙UVa 11292
- UVA 11292 勇者斗恶龙,排序
- UVA 11292(Dragon of Loowater-勇者斗恶龙)
- UVa 11292 Spreading the Wealth 勇者斗恶龙
- 勇者斗恶龙(The Dragon Loowater,UVA 11292)
- uva 11292 Dragon of Loowater (勇者斗恶龙)
- 勇者斗恶龙(The Dragon of Loowater) UVa 11292 HDU 1902
- uva 11292 Dragon of Loowater (勇者斗恶龙系列)
- 勇者斗恶龙(The Dragon of Loowater, UVa 11292)
- UVa 11292 The Dragon of Loowater 勇者斗恶龙
- uva 11292 勇者斗恶龙 The Dragon of Loowater
- 勇者斗恶龙(The Dragon of Loowater, UVa 11292)
- 例题5-1 UVA 11292 The Dragon of Loowater勇者斗恶龙
- 勇者斗恶龙
- 勇者斗恶龙
- 一个不错的素材网站-千图网
- 关键词推荐工具中的用户引导机制之二
- Oracle EBS R12 AP模块主要表结构整理
- 【Android开发】Android开发环境搭建----第一个Android程序Hello World(中)
- 千万级的mysql数据库与sql优化方法
- UVA 11292 勇者斗恶龙
- Python编程中常用的12种基础知识总结
- solr学习之三--------Document、FieldType
- 【Android开发】Android开发环境搭建----第一个Android程序Hello World(下)
- [互联网面试笔试汇总C/C++-13] 写一个程序来判断机器的大小端-微策略
- 技术团队的培养和领导
- like ,order 使用索引
- 使用keytool查看Android的keyfile
- 8种基本数据类型