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