UVa 11292 Spreading the Wealth 勇者斗恶龙
来源:互联网 发布:万企网络是干嘛的 编辑:程序博客网 时间:2024/04/30 01:33
对恶龙的头和骑士的能力排一次序即可
代码:
#include<stdio.h>#include<math.h>#include<string.h>#include<algorithm>#include<limits.h>using namespace std;#define MAXSIZE 20005int a[MAXSIZE],b[MAXSIZE];int main(){int m,n;while(scanf("%d %d",&m,&n)!=EOF&&m+n){for(int i=1; i<= m; i++)scanf("%d",&a[i]);for(int i=1; i<= n; i++)scanf("%d",&b[i]);if(m> n)printf("Loowater is doomed!\n");else{sort(a+1,a+m+1);sort(b+1,b+n+1);int ans= 0;int t= 1,j= 1;while(j<= n&&t<= m){if(b[j]>= a[t]){ans+= b[j];//printf(": %d\n",b[j]);t++;j++;}elsej++;}if(t==m+1)printf("%d\n",ans);elseprintf("Loowater is doomed!\n");}}return 0;}
0 0
- UVa 11292 Spreading the Wealth 勇者斗恶龙
- Spreading the Wealth UVA
- Spreading the Wealth UVA
- Uva - 11300 - Spreading the Wealth
- uva 11300 - Spreading the Wealth
- Uva-11300-Spreading the Wealth
- UVA 11300 Spreading the Wealth
- UVa 11300 - Spreading the Wealth
- uva 11300 Spreading the Wealth
- UVA 11300 Spreading the Wealth
- uva 11300 Spreading the wealth
- UVA - 11300 Spreading the Wealth
- UVa 11300 Spreading the Wealth
- UVA 11300 Spreading the Wealth
- UVa 11300 Spreading the Wealth
- UVA 11300 Spreading the Wealth
- UVA 11300 - Spreading the Wealth
- UVA - 11300 Spreading the Wealth
- 测试
- linux 环境下c,c++编程(二):C编程中的编译文件
- 【元数据分布算法研究笔记】-Lazy Hybrid
- 实现抓屏幕功能!
- IIS建站小工具
- UVa 11292 Spreading the Wealth 勇者斗恶龙
- shell中$*与$@的区别
- 在电脑中如何截取android系统中的当前界面
- 测试类中静态对象变量在对此建立对象的时候静态类是否会多次建立
- android.os.NetworkOnMainThreadException
- Linux中在应用程序菜单中添加快捷方式
- HTTP错误代码详细介绍
- Oracle的全文索引--切词
- java调用exe文件