POJ 3646 The Dragon of Loowater G++
来源:互联网 发布:软件系统运维 编辑:程序博客网 时间:2024/06/02 02:34
#include <iostream>#include <vector>#include <algorithm>//龙头要同时砍 using namespace std;int main(){vector<int> jg;while(1){int ln;int kn;cin>>ln>>kn;if((ln==0)&&(kn==0)){break;}vector<int> l;vector<int> k;for(int i=0;i<ln;i++){int t;cin>>t;l.push_back(t);}sort(l.begin(),l.end());for(int i=0;i<kn;i++){int t;cin>>t;k.push_back(t);}sort(k.begin(),k.end()); int qian=0;int j=0;for(int i=0;i<k.size();i++){if((j<l.size())&&(k[i]>=l[j])){j++;qian=qian+k[i];}} if(j==l.size()){jg.push_back(qian);}else{int t=-1;jg.push_back(t);}}for(int i=0;i<jg.size();i++){if(jg[i]==-1){cout<<"Loowater is doomed!"<<endl;}else{cout<<jg[i]<<endl;}}return 0;}
0 0
- POJ 3646 The Dragon of Loowater G++
- POJ-3646-The Dragon of Loowater
- poj 3646 The Dragon of Loowater!水!!
- POJ-3646 The Dragon of Loowater
- POJ 3646 The Dragon of Loowater
- POJ 3646 Dragon of Loowater
- POJ 3646 Dragon of Loowater
- 白皮书:The Dragon of Loowater, UVa 11292,POJ 3646
- poj 3646 The Dragon of Loowater 排序+贪心
- POJ - 3646 The Dragon of Loowater(贪心)
- 周赛 POJ 3546 The Dragon of Loowater
- The Dragon of Loowater
- The Dragon of Loowater
- The Dragon of Loowater
- The Dragon of Loowater
- The Dragon of Loowater
- The Dragon of Loowater
- UVA11292 The Dragon of Loowater
- jar文件打不开解决的办法
- Vim配置#Vim PHP函数 Tab自动提示功能
- 即时通讯openfire4.1.1+smack4.1.0
- java笔记【1】
- JavaScript变量作用域
- POJ 3646 The Dragon of Loowater G++
- fantastic summary for backtrack
- 面向对象设计的六大原则
- 蓝桥杯 算法训练 筛选号码
- vim delete all after space for each line
- 原生JS如何利用冒泡减少事件的触发,只代理给共有的父元素。
- 监督学习-adaboost元算法模板
- 对于大流量的网站,您采用什么样的方法来解决访问量问题?
- STL中vector,list,deque和map的区别