uva --11292 --Dragon of Loowater
2012-11-26 15:12
246 查看
无需多言,上代码~~~~~~
int a[maxn],b[maxn]; int n,m; bool init() { scanf("%d%d",&n,&m); if(n+m==0)return false; return true; } void slove() { int cost=0; for(int i=0;i<n;i++) scanf("%d",&a[i]); for(int i=0;i<m;i++) scanf("%d",&b[i]); if(n>m) { cout<<"Loowater is doomed!\n"; return; } sort(a,a+n); sort(b,b+m); int cnt=0; for(int i=0;i<m;i++) { if(b[i]>=a[cnt]) { cost+=b[i]; cnt++; if(cnt==n)break; } } if(cnt<n) printf("Loowater is doomed!\n"); else printf("%d\n",cost); } int main() { while(init()) slove(); return 0; }
相关文章推荐
- UVA 11292 Dragon of Loowater
- The Dragon of Loowater, UVa 11292
- UVA11292 Dragon of Loowater
- UVA 11292 - Dragon of Loowater
- UVa 11292 - Dragon of Loowater
- UVA - 11292 - Dragon of Loowater
- UVA 11292(HDU 1902)The Dragon of Loowater
- 【uva 11292】Dragon of Loowater
- UVa 11292 The Dragon of Loowater 【贪心】
- Uva 11292 Dragon of Loowater
- JAVA-勇者斗恶龙-The Dragon of Loowater,Uva 11292-排序后贪心
- UVA 11292 Dragon of Loowater 贪心 .
- uva 11292 - Dragon of Loowater
- UVa 11292 - Dragon of Loowater[贪心]
- Uva 11292 The Dragon of Loowater 模拟题
- UVA11292 - Dragon of Loowater
- The Dragon of Loowater UVa 11292(排序后贪心)
- Uva-11292-Dragon of Loowater
- 勇者斗恶龙(Dragon of Loowater ,UVa 11292)
- UVa 11292 Dragon of Loowater