[Hidden ☆ before use]
#### 1253. B. Soccer Standings

#### Description

In a soccer match, a team either earns a win, tie or loss. A win is worth 3 points, a tie is worth 1 point, and a loss is worth 0 points. Unfortunately, due to poor record-eeping, some leagues have only saved the number of total matches played and the number of points each team has earned. One of these leagues has asked you to write a program to recreate the possible combinations of wins, ties and losses for certain teams in the league. The Problem: Given the number of games played by a soccer team in a season and the number of points earned by the team, list each possible combination of wins, ties and losses that the team could have gotten to achieve the given total points.
#### Input

The first input line contains a positive integer, n, indicating the number of teams for which you are to reconstruct possible records. The teams’ information are on the following n input lines, one team per line. Each of these lines contains two space separated integers: g (0 < g ≤ 100), and p (0 ≤ p ≤ 300), representing the number of games played and the total points earned by the team, respectively. It is guaranteed that there is at least one possible combination of wins, ties and losses that is consistent with the given information for each team.
#### Output

For each team, first output header info with the following format:

Team #k

Games: g

Points: p

Possible records:

where k is the team number (starting with 1), g is the number of games, and p is the total points earned. Following the above header info, output the possible records, each on a separate linewith the format: w-t-l

where w is the number of wins, t is the number of ties and l is the number of losses. Print these by descending order of wins.

Leave a blank line after the output for each team. Follow the format illustrated in Sample Output.

#### Samples

#### Source

UCF2014

Team #k

Games: g

Points: p

Possible records:

where k is the team number (starting with 1), g is the number of games, and p is the total points earned. Following the above header info, output the possible records, each on a separate linewith the format: w-t-l

where w is the number of wins, t is the number of ties and l is the number of losses. Print these by descending order of wins.

Leave a blank line after the output for each team. Follow the format illustrated in Sample Output.

Input
Copy

3 6 10 1 3 4 4

Output

Team #1 Games: 6 Points: 10 Possible records: 3-1-2 2-4-0 Team #2 Games: 1 Points: 3 Possible records: 1-0-0 Team #3 Games: 4 Points: 4 Possible records: 1-1-2 0-4-0

Time Limit: | 1000MS (C/C++,Others×2) |

Memory Limit: | 128MB (C/C++,Others×2) |

Special Judge: | No |

AC/Submit: | 1 / 1 |

Tags: |