(Hdu step 1.3.5) Fighting for HDU (sorting)

Source: Internet
Author: User

(Hdu step 1.3.5) Fighting for HDU (sorting)

Question:

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 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 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 there is still a health effect, but it is not clinically verified. Therefore, the company's sales are increasing year by year, and profits are 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 hospitalized for many times because of hand cramps caused by Banknote farming, now, in front of her, you should not mention the word "Banknote", or even "money". Otherwise, her hands will immediately crud, 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?
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, please 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 Input
35 2 61 3 40
Sample Output
6 vs 0 Can HDU win this round? To learn about the future and listen to the next decomposition --
Authorlcy
SourceACM programming _ final examination (the time has been set !!)
Recommendlcy


Question Analysis:

I will not explain this question.



The Code is as follows:

/** E. cpp ** Created on: January 29, 2015 * Author: Administrator */# include
 
  
# Include
  
   
# Include 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 ;}
  
 




Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.