Basketball Games (APCS 2019-06 Beginner)
Points 100 1.0s 256MAPCS held a basketball league. Each game has a home team and an away team. Your task is to summarize the information of each game into a short message.
Each game is played in four quarters, and a team's score for a game is the sum of its scores across the four quarters. There are two games in total. You need to determine the winner of each game based on the teams' total scores, and then summarize the overall result of the two games.
Input
There are four lines of numbers representing two games, with four numbers per line representing the scores of four quarters:
- The first line is the home team's scores in the four quarters of game 1
- The second line is the away team's scores in the four quarters of game 1
- The third line is the home team's scores in the four quarters of game 2
- The fourth line is the away team's scores in the four quarters of game 2
Constraints:
- All scores are integers between \(0\) and \(100\)
- It is guaranteed that no game ends in a tie (equal totals); both games have a clear winner
Output
For each game, output one line with the score of the home team and the away team, in the format home_total:away_total (separated by a single half-width colon :).
Then output one final line representing the overall result of the two games:
- If the home team won both games, output
Win - If the away team won both games, output
Lose - If each team won one game (a draw overall), output
Tie
Scoring
The time limit for each test case is \(1\) second; your score is the sum over the test cases you pass.
Sample Input
87 87 87 87
78 78 78 78
87 87 87 87
78 78 78 78
Sample Output
348:312
348:312
Win
Sample Explanation
In both games the home team totals \(87 \times 4 = 348\) and the away team totals \(78 \times 4 = 312\). The home team wins both games, so the final output is Win.
Source
APCS programming exam, June 2019, Problem 1.
Log in to write and submit code.
Log in