(Hdu step 1.3.5) Fighting for HDU (sort)

Source: Internet
Author: User

Topic:

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 let you guess the shape of the East Sea Group land, you guessed right? Regardless of the outcome, it doesn't matter, I continue to explain to you the development of the East Sea Group:
In the first two years, the development of HDU very quickly, integrated with various ACM algorithm produced by the rat drug effect is very good, it is said that the drug is effective for mice, if swallowed, no side effects, and even rumors that there is the effect of the stomach, but this has not been clinically validated. Therefore, the company's sales increase year by month, the profit is also climbing, as one of the shareholders of the princess responsible for finance, the recent six months, she really hard, many times because of the hands of the hand cramps and hospitalization, now in front of her you do not mention "money" two words, and even the "currency", otherwise she immediately hands cramp, Poor princess ...
The development of the East Sea Group was greatly encouraged, but also caused the neighboring industry "Toyo Small Gou Co., Ltd." Jealousy, see the sea East group gradually put their original market one by one occupied, heart naturally unwilling, so sent n individuals came to provoke, proposed to a competition really kung fu of the Chinese and Japanese showdown, The loser has to quit the rat drug market automatically!
The rules they put forward are the following:
1. Each party sends n individual to participate;
2. The order of the races must be from weak to strong (the main concern is that the Chinese are good at tin bogey horse racing);
3. Each win one, get two points, draw a point, otherwise 0 points.
Toyo Small Gou Sure enough black, but they never thought, hdu but Crouching Tiger Hidden Dragon, not only move if Bunny Linle, but also strong as the false * * * * * *, more Sha Jianmi Mr. Heying and because the hands cramp and practice into the Eagle Claw work of the Moon Princess, estimated small Gou they also accounted for nothing cheap.
Assuming that each player's ability is represented by an integer, can you tell me the final result?
Input inputs contain multiple sets of test data, each set of data accounted for 3 rows, the first line is an integer n (n<100), the number of players per party, followed by two lines each row contains n integers, respectively, the ability of the Chinese and Japanese two people, N is 0 when the end of the input.
Output for each test instance, export the result of the match, the format of the result as shown in the sample (there is only one space between the number and VS), where the HDU score is in front.
The output for each instance takes up one row.
Sample Input
35 2 61) 3 40
Sample Output
6 vs 0 this time showdown, can hdu win? To know the funeral, and listen to tell--
Authorlcy
SOURCEACM Program Design _ Final Exam (time has been set!!) )
Recommendlcy


Topic Analysis:

A flood problem, not explained.



The code is as follows:

/* * e.cpp * *  Created on:2015 January 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;}




(Hdu step 1.3.5) Fighting for HDU (sort)

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.