Fighting for HDU
Time Limit: 3000/1000 MS (Java/others) memory limit: 32768/32768 K (Java/Others)
Total submission (s): 3100 accepted submission (s): 1577
Problem description
In the last time, we asked you to guess the shape of the Haidong group's land use. Are you right? Regardless of the result, it does not matter. I will continue to explain the development of Haidong group to you:
In
In the first two years, HDU has developed very rapidly. The effects of the mouse drug generated by various ACM algorithms are remarkable. It is said that the drug is effective for rats. If it is accidentally eaten, it has no side effects, there are even rumors that
However, it is not clinically verified. Therefore, the company's sales are increasing year by year, and the profit is also rising. As one of the shareholders, the Princess is in charge of finance. In the past six months, she has worked very hard and has been counting money for many times.
The ticket causes both hands cramps and is in hospital. Now in front of her, you should not mention the word "Banknote", or even "money". Otherwise, she will immediately crud her hands, Alas, poor princess...
The development of the Haidong group has aroused great excitement among Chinese people, but it has also aroused the jealousy of the neighboring countries in the same industry "Toyo Xiaoyu Co., Ltd.". Seeing that the Haidong group has gradually occupied their original markets one by one, it is unwilling to do so, so I sent n people to come to the challenge and proposed to come to a Chinese-Japanese competition. the losing party should automatically exit the rat's drug market!
The rules they proposed are as follows:
1. Each Party sends n persons to participate in the competition;
2. The competition sequence must be from weak to strong (mainly worried about Tianji horse racing which the Chinese are good );
3. Every time you win a game, you get two points and one point. Otherwise, you get 0 points.
Dongyang Xiaoyu is really black enough, but they never imagined that HDU is a crouching tiger, a hidden dragon, not only a dynamic linle, but also a fake like a cow **, in addition, Mr. heying of Xiasha bodybuilder and the Moon Princess who has become an e due to hand cramps, it is estimated that they do not take any advantage of Xiao.
If each player's abilities are represented by an integer, can you tell me the final result?
Input
The input contains multiple groups of test data. Each group occupies three rows. The first row is an integer n (n <100), indicating the number of players on each side, each row in the second row contains N integers, which indicate the capability values of the Chinese and Japanese personnel respectively. When n is 0, the input is terminated.
Output
For each test instance, output the results of the competition. The format of the results is shown in the example (there is only one space between the number and VS), where the score of HDU is in front.
The output of each instance occupies one row.
Sample input3
5 2 6
1 3 4
0
Sample output6 vs 0
Can HDU win this round? To learn about the future and listen to the next decomposition --
Author
Lcy
Source
ACM programming _ final examination (the time has been set !!)
1 #include <stdio.h>
2 #include <algorithm>
3 using namespace std;
4
5 int a[10000], b[10000];
6
7 int main( )
8 {
9
10 int N,i, j,sa,sb;
11 while(scanf("%d",&N), N)
12 {
13 sa = sb = 0;
14 for(i = 0; i < N;i++)
15 scanf("%d", &a[i]);
16 for(i = 0; i < N;i++)
17 scanf("%d", &b[i]);
18 sort(a, a + N);
19 sort(b, b + N);
20 for(i = 0;i < N; i++)
21 if(a[i] > b[i] )
22 sa += 2;
23 else if (a[i] == b[i])
24 sa += 1, sb += 1;
25 else
26 sb += 2;
27 printf("%d vs %d\n",sa, sb);
28 }
29 return 0;
30 }
Recommend
Lcy