0% found this document useful (0 votes)
57 views

Soccer Standings: Problem E

The document describes a problem where soccer teams' records need to be reconstructed from limited information. Teams are given with the number of games played and total points earned. The task is to list all possible combinations of wins, ties, and losses that could result in the given points total. The input provides this data for multiple teams, and the output must print a header with each team's details and all valid potential records in descending order of wins.

Uploaded by

Abinadad Morales
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
57 views

Soccer Standings: Problem E

The document describes a problem where soccer teams' records need to be reconstructed from limited information. Teams are given with the number of games played and total points earned. The task is to list all possible combinations of wins, ties, and losses that could result in the given points total. The input provides this data for multiple teams, and the output must print a header with each team's details and all valid potential records in descending order of wins.

Uploaded by

Abinadad Morales
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Concurso de programación ANIEI 2020 7

Problem E
Soccer Standings
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-keeping, 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.
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 line with 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 Example Output.
Concurso de programación ANIEI 2020 8

Examples
Input Output
3 Team #1
6 10 Games: 6
1 3 Points: 10
4 4 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

You might also like