### Problem Statement

Since the rules of basketball do not allow games to result in ties, comparing two teams during a tournament is usually done by comparing the number of games they've won. When comparing two teams that have played a different number of games, the team that played k games less than the other gets k/2 added to its win total. For further clarification, please see the following table (the notation 7/15 means that a team played 15 games and won 7 of them):

```Team A   Team B    Difference
7 / 15   8 / 20    Team A played 5 games less than team B, so we assume it will win 2.5 games more.
Therefore Team A is (7 + 2.5) - 8 = 1.5 games ahead of team B.
8 / 8    18 / 18   Though both teams have won all their games, team A played 10 games less.
We assume it wins 5 of those 10 games, so it is 5 games behind team B.
20 / 40  10 / 20   Team B played 20 games less, so we assume it will have 10 more wins.
Therefore, the gap between the teams is 0.
```

Since this comparison is transitive (if team A is better than team B, and team B is better than team C, then team A is better than team C), the teams can be placed into the standings table according to this order. If the gap between two teams is 0, the team whose name comes earlier alphabetically is given the better rank.

You will be given a String[] teams, with the i-th element of teams representing the i-th team. Each element of teams will be formatted as "NAME WINS LOSSES" (quotes for clarity), where NAME is a sequence of uppercase letters representing the name of the team, and WINS and LOSSES are integers representing the number of games the team won and lost respectively. You are to sort teams from the best to worst according to the comparison method defined above, and return the standings as a String[]. Each element of the result must be formatted as "NAME GAP" (quotes for clarity), where NAME is the team's name and GAP is the gap between this team and the top team in the standings. GAP must consist of one or more digits, followed by a decimal point, followed by exactly one digit. There must be no extra leading zeroes. For example, "0.0", "0.5" and "1.0" are valid, but ".5", "0", "05.0" and "5." are not.

### Definition

 Class: BasketballStandings Method: constructTable Parameters: String[] Returns: String[] Method signature: String[] constructTable(String[] teams) (be sure your method is public)

### Constraints

-teams will contain between 1 and 50 elements, inclusive.
-Each element of teams will contain between 5 and 16 characters, inclusive.
-Each element of teams will be formatted as "NAME WINS LOSSES" (quotes for clarity).
-In each element of teams, NAME will contain between 1 and 10 uppercase letters ('A'-'Z'), inclusive.
-In each element of teams, WINS will be an integer between 0 and 99, with no extra leading zeroes.
-In each element of teams, LOSSES will be an integer between 0 and 99, with no extra leading zeroes.

### Examples

0)

 `{"A 1 1", "A 8 8","D 0 0", "B 7 7", "C 99 99", "BAA 13 13"}`
`Returns: {"A 0.0", "A 0.0", "B 0.0", "BAA 0.0", "C 0.0", "D 0.0" }`
 All teams win 50% of their games. They are all tied in the standings and sorted in alphabetical order. Please note that multiple teams may have the same name.
1)

 `{"B 11 10", "A 10 10", "C 10 11", "D 20 5"}`
`Returns: {"D 0.0", "B 7.0", "A 7.5", "C 8.0" }`
 D is a clear favorite here. Team B played 1 game more than team A, therefore A is supposed to get 0.5 wins out of this game. Since B has 1 win more, it is 0.5 wins ahead of team A. Team B and team C played the same number of games. Team B get 1 win more, therefore it is 1 win ahead.
2)

 `{"MAVS 54 11", "SUNS 50 16", "SPURS 46 20", "JAZZ 43 23"}`
`Returns: {"MAVS 0.0", "SUNS 4.5", "SPURS 8.5", "JAZZ 11.5" }`
 Top 4 NBA team as of March 20, 2007.
3)

 ```{"TEAMA 17 15", "TEAMB 14 11", "TEAMC 3 0", "TEAMD 99 94", "LOSER 10 85", "WINNER 76 34"}```
```Returns:
{"WINNER 0.0",
"TEAMD 18.5",
"TEAMB 19.5",
"TEAMC 19.5",
"TEAMA 20.0",
"LOSER 58.5" }```

#### Problem url:

http://www.topcoder.com/stat?c=problem_statement&pm=7538

#### Problem stats url:

http://www.topcoder.com/tc?module=ProblemDetail&rd=10731&pm=7538

Olexiy

#### Testers:

PabloGilberto , brett1479 , vorthys

Math