UVA 1418-wonderteam

Source: Internet
Author: User

Test instructions: You n team to play, every two teams to play 2 games, win 3 points, flat 1 points, lose 0 points, after the game to select a Dream team, the number of goals required to score the most, the largest number of wins, the fewest number of missed goals, and three can not be compared with the other column first. Ask about the lowest possible ranking of the Dream team.

Analysis: its real 3 limit conditions only the number of victories is most useful, because the dream team can win the victory of the game, the loss is 1:0 negative to the opponent, the other two is irrelevant. Keeping the dream team as low as possible means keeping it as low as possible. Then we assume that the Dream Team's winning field number is 2, the other teams have a winning field of 1, then meet the above conditions, but also let the dream Team score as low as possible. The total matches are 2n-2;

Dream Team (1): Win 2, lose n-1, Ping n-3, score: n+3

Two teams won by the Dream Team (2): Win 1, lose 1, Ping: 2n-4, Score: 2n-1

Other teams (N-3): Win 1, lose 0, Ping: 2n-3, score: 2n

1#include <iostream>2#include <cstdio>3#include <algorithm>4 using namespacestd;5 intMain ()6 {7     intN;8      while(SCANF ("%d", &n) &&N)9     {Ten         if(n<=3) Onecout<<"1"<<Endl; A         Else if(n==4) -cout<<2<<Endl; -         Else thecout<<n<<Endl; -     } -     return 0; -}

UVA 1418-wonderteam

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.