UVa 10698 - Football Sort

Summary
Follow the instruction to calculate the points for each team, (the Simulation part of the problem) and then sort according to the criteras. (The Sorting part of the problem.) There is also a little string parsing to read the input. (The Ad Hoc part of the problem.)

Explanation
The scoring system is a standard scoring system - Three points for a win, one point for a draw, and no points for a loss.

Then, sort by the following criterias:
 * Points
 * Goal Differences
 * Scored Goals

Gotcha's

 * For tied teams:
 * Do not repeat the positions - see the output for sample.
 * Sort alphabetically - NOT by ASCII!
 * Watch out for formating and aligning to avoid PE.
 * Use N/A when a team hasn't played a game.

Input
6 10 tA tB tC td tE tF tA 1 - 1 tB tC 0 - 0 td tE 0 - 0 tA tC 0 - 0 tB td 0 - 0 tE tA 0 - 0 tC tB 0 - 0 tE td 0 - 0 tA tE 0 - 0 tC tB 0 - 0 td 2 2 Botafogo Flamengo Botafogo 3 - 2 Flamengo Flamengo 2 - 3 Botafogo 5 10 tA tB tC tD tE tA 0 - 0 tB tC 0 - 0 tD tE 0 - 0 tA tC 0 - 0 tB tD 0 - 0 tE tA 0 - 0 tC tB 0 - 0 tE tD 0 - 0 tA tE 0 - 0 tC tB 0 - 0 tD 3 2 Quinze-Novembro Flamengo Santo-Andre Quinze-Novembro 6 - 0 Flamengo Flamengo 0 - 2 Santo-Andre 0 0

Output
1.             tA   4   4   1   1   0  33.33 tB  4   4   1   1   0  33.33 3.             tC   4   4   0   0   0  33.33 td  4   4   0   0   0  33.33 tE  4   4   0   0   0  33.33 6.             tF   0   0   0   0   0    N/A

1.       Botafogo   6   2   6   4   2 100.00 2.       Flamengo   0   2   4   6  -2   0.00

1.             tA   4   4   0   0   0  33.33 tB  4   4   0   0   0  33.33 tC  4   4   0   0   0  33.33 tD  4   4   0   0   0  33.33 tE  4   4   0   0   0  33.33

1. Quinze-Novembro  3   1   6   0   6 100.00 2.    Santo-Andre   3   1   2   0   2 100.00 3.       Flamengo   0   2   0   8  -8   0.00