(hdu step 1.3.5)Fighting for HDU(排序)

题目:

Fighting for HDU

Time Limit: 3000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 2412 Accepted Submission(s): 1210
 

Problem Description

在上一回,我们让你猜测海东集团用地的形状,你猜对了吗?不管结果如何,都没关系,下面我继续向大家讲解海东集团的发展情况:
在最初的两年里,HDU发展非常迅速,综合各种ACM算法生成的老鼠药效果奇好,据说该药专对老鼠有效,如果被人误食了,没有任何副作用,甚至有传闻说还有健胃的效果,不过这倒没有得到临床验证。所以,公司的销量逐年递增,利润也是节节攀升,作为股东之一的公主负责财务,最近半年,她实在辛苦,多次因为点钞票造成双手抽筋而住院,现在在她面前你根本不要提到“钞票”二字,甚至“money”也不行,否则她立马双手抽筋,唉,可怜的公主…
海东集团的发展令国人大为振奋,不过也引起了邻国同行业“东洋小苟株式会社”的嫉妒,眼看海东集团逐渐把他们原来的市场一一占领,心中自是不甘,于是派了n个人前来挑衅,提出要来一场比试真功夫的中日擂台赛,输的一方要自动退出老鼠药市场!
他们提出的比赛规则是这样的:
1.  每方派出n个人参赛;
2.  出赛的顺序必须是从弱到强(主要担心中国人擅长的田忌赛马);
3.  每赢一场,得两分,打平得一分,否则得0分。
东洋小苟果然够黑,不过他们万万没有想到,HDU可是卧虎藏龙,不仅有动若脱兔的Linle,还有力大如牛的伪**,更有下沙健美先生HeYing以及因为双手抽筋而练成鹰爪功的月亮公主,估计小苟他们也占不到什么便宜。
假设每个队员的能力用一个整数来表示,你能告诉我最终的结果吗?


Input

输入包含多组测试数据,每组数据占3行,首先一行是一个整数n(n<100),表示每方上场队员的人数,接着的二行每行包含n个整数,分别依次表示中日两方人员的能力值,n为0的时候结束输入。


Output

对于每个测试实例,请输出比赛的结果,结果的格式如样例所示(数字和vs之间有且仅有一个空格),其中,HDU的比分在前。
每个实例的输出占一行。


Sample Input

3
5 2 6
1 3 4
0


Sample Output

6 vs 0

这次的擂台赛,HDU能赢吗?欲知后事如何,且听下回分解——


Author

lcy


Source

ACM程序设计_期末考试(时间已定!!)


Recommend

lcy

题目分析:

大水题,不解释。

代码如下:

/*
 * e.cpp
 *
 *  Created on: 2015年1月29日
 *      Author: Administrator
 */

#include <iostream>
#include <cstdio>
#include <algorithm>

using namespace std;

const int maxn = 105;

int a[maxn];
int b[maxn];

int main(){
	int n;
	while(scanf("%d",&n)!=EOF,n){
		int i;
		for(i = 0 ; i < n ; ++i){
			scanf("%d",&a[i]);
		}

		for(i = 0 ; i < n ; ++i){
					scanf("%d",&b[i]);
				}

		sort(a,a+n);
		sort(b,b+n);

		int sum1=0;
		int sum2=0;

		for(i = 0 ; i < n ; ++i){
			if(a[i] > b[i]){
				sum1+=2;
			}else if(a[i] == b[i]){
				sum1+=1;
				sum2+=1;
			}else{
				sum2+=2;
			}

		}

		printf("%d vs %d\n",sum1,sum2);
	}

	return 0;
}
时间: 2024-11-05 22:23:53

(hdu step 1.3.5)Fighting for HDU(排序)的相关文章

(hdu step 7.1.1)Shape of HDU(推断一个多边形是否是凸多边形)

题目: Shape of HDU Time Limit: 3000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 159 Accepted Submission(s): 97   Problem Description 话说上回讲到海东集团推选老总的事情,最终的结果是XHD以微弱优势当选,从此以后."徐队"的称呼逐渐被"徐总"所代替,海东集团(

(hdu step 1.3.8)Who&#39;s in the Middle(排序)

题目: Who's in the Middle Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 2938 Accepted Submission(s): 1109   Problem Description FJ is surveying his herd to find the most average cow. He wants to k

HDU2109 Fighting for HDU【水题】

Fighting for HDU Time Limit: 3000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 7486    Accepted Submission(s): 3854 Problem Description 在上一回,我们让你猜测海东集团用地的形状,你猜对了吗?不管结果如何,都没关系,下面我继续向大家讲解海东集团的发展情况: 在最初的两年里,HDU

(hdu step 1.3.1)FatMouse&#39; Trade(在收入需要一定的付出的情况下求最大收入)

题目: FatMouse' Trade Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 5092 Accepted Submission(s): 1530   Problem Description FatMouse prepared M pounds of cat food, ready to trade with the cats gua

(hdu step 6.1.2)Eddy&#39;s picture(在只给出二维坐标点的情况下,求让n个点连通的最小费用)

题目: Eddy's picture Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 172 Accepted Submission(s): 126   Problem Description Eddy begins to like painting pictures recently ,he is sure of himself to be

(hdu step 5.1.1)A Bug&#39;s Life((ai,bi)表示ai、bi不在同一堆中,有若干对数据,判断是否有bug)

题目: A Bug's Life Time Limit: 15000/5000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 723 Accepted Submission(s): 277   Problem Description Background Professor Hopper is researching the sexual behavior of a rare spe

(hdu step 3.2.4)FatMouse&#39;s Speed(在第一关键字升序的情况下,根据第二关键字来求最长下降子序列)

在写题解之前给自己打一下广告哈~..抱歉了,希望大家多多支持我在CSDN的视频课程,地址如下: http://edu.csdn.net/course/detail/209 题目: FatMouse's Speed Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 1034 Accepted Submission(s): 526   Proble

(hdu step 3.1.5)Tiling_easy version(求用2*1、2*2两种骨格铺满2*n的网格的方案数)

在写题解之前给自己打一下广告哈~..抱歉了,希望大家多多支持我在CSDN的视频课程,地址如下: http://edu.csdn.net/course/detail/209 题目: Tiling_easy version Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 515 Accepted Submission(s): 447   Prob

ACM学习历程—HDU 4726 Kia&#39;s Calculation( 贪心&amp;&amp;计数排序)

DescriptionDoctor Ghee is teaching Kia how to calculate the sum of two integers. But Kia is so careless and alway forget to carry a number when the sum of two digits exceeds 9. For example, when she calculates 4567+5789, she will get 9246, and for 12