Football
InterviewTime limit2sMemory limit1024 MB
For each first-leg score a:b, count the second-leg results where LAG wins and where DCU wins, by total goals and then away goals.
- Level
Easy2 of 10
- Topics
- Brute force, Implementation
- Solved
- No attempts yet
Problem
House and Wilson were watching the MLS Cup final between LAG and DCU when they argued again. House said LAG would win, and Wilson said DCU would win. When the first leg of the two-match final ended, Wilson began working out which results of the second leg would let him win the bet.
A team wins the two-leg series if it scores more goals than its opponent over both matches. If both teams have the same total, the team that scored more goals away from home wins. If the away goals are also equal, two extra halves are played. For this problem, this outcome counts as a draw.
The first match is played at LAG's stadium, and the second is played at DCU's stadium. Wilson assumed that no team scores more than nine goals. Help Wilson count the outcomes in which LAG wins the cup and the outcomes in which DCU wins the cup. Each test gives the result of the first match.
Input
The first line contains the integer (), the number of tests. Each of the next lines contains the first match result in the format a:b, where is the number of goals scored by LAG and is the number of goals scored by DCU.
Output
For each of the tests, print on one line two numbers: the number of outcomes in which LAG wins, and the number of outcomes in which DCU wins.