UVA 11292 The Dragon of Loowater
2016-10-10 22:17
357 查看
蓝书……
#include<stdio.h> #include<iostream> #include<math.h> #include<string.h> #include<iomanip> #include<stdlib.h> #include<ctype.h> #include<algorithm> #include<deque> #include<functional> #include<iterator> #include<vector> #include<list> #include<map> #include<queue> #include<set> #include<stack> #include<sstream> #define CPY(A,B)memcpy(A,B,sizeof(A)) typedef long long LL; typedef unsigned long long uLL; const int MOD=1e9+7; const int INF=0x3f3f3f3f; const LL INFF=0x3f3f3f3f3f3f3f3fLL; const double EPS=1e-9; const double OO=1e20; const double PI=acos (-1.0); int dx[]= {0,1,0,-1}; int dy[]= {1,0,-1,0}; int gcd (const LL &a,const LL &b) {return b==0?a:gcd (b,a%b);} using namespace std; const int MAX=20010; int A[MAX],B[MAX]; int main() { int n,m; while (~scanf ("%d%d",&n,&m) ) { if (! (n+m) ) { break; } for (int i=0; i<n; ++i) {scanf ("%d",&A[i]);} for (int i=0; i<m; ++i) {scanf ("%d",&B[i]);} sort (A,A+n); sort (B,B+m); int pos=0,ans=0; for (int i=0; i<m; ++i) { if (B[i]>=A[pos]) { ans+=B[i]; if (++pos==n) { break; } } } if (pos<n) { printf ("Loowater is doomed!\n"); } else { printf ("%d\n",ans); } } return 0; }
相关文章推荐
- UVA11292 The Dragon of Loowater
- (UVA step1)UVA 11292 The Dragon of Loowater(有n条恶龙,m个骑士,求杀死恶龙的最小代价)
- UVa 11292 The Dragon of Loowater 【贪心】
- UVA 11292 The Dragon of Loowater 英文略长略长
- 贪心/思维题 UVA 11292 The Dragon of Loowater
- UVa 11292 - The Dragon of Loowater
- ACM——The Dragon of Loowater(UVa 11292)
- UVA11292-The Dragon of Loowater
- UVa 11292 The Dragon of Loowater (贪心)
- UVa 11292 The Dragon of Loowater 简单的比较题
- Uva---11292Problem C: The Dragon of Loowater (贪心)
- UVA 11292 The Dragon of Loowater(排序问题系列)
- UVa 11292 The Dragon of Loowater
- UVA 11292 - The Dragon of Loowater (water)
- The Dragon of Loowater UVa 11292(排序后贪心)
- 白皮书:The Dragon of Loowater, UVa 11292,POJ 3646
- UVA11292 The Dragon of Loowater
- (uva 11292)勇士斗恶龙(The Dragon of Loowater)
- The Dragon of Loowater_uva11292_poj3646
- UVa 11292 The Dragon of Loowater 勇者斗恶龙