Defeat your rivals with superior numbers!
Aim for the 6!
Maths of Glory is a 2v2. minigame in Super Mario Party, and you can
view how the game is actually played
here. Each team has a castle that is
made up of
In each round, each player will hit a slot with numbers ranging from 1
to 6. The numbers from the two players in the same team will be
multiplied to be the points

Given the numbers each player hits in each round, write a program to determine which team wins the game.
Input Specification
The first line of the input contains two integers,
Output Specification
Output the winning team and when they win. For example, if team 1 wins
at round 5, output Team 1 wins at round 5!
.
If they both win at a certain round It's a tie at round x!
.
If the game ends with neither team winning, output Oh no!
.
Sample Input 1
20 6
2 4 6 3
3 3 1 5
5 2 2 1
1 1 1 1
6 3 1 4
2 6 4 1
Sample Output 1
Team 2 wins at round 2!
Sample Input 2
30 6
2 4 6 3
3 3 1 5
5 2 2 1
1 1 1 1
6 3 1 4
2 6 4 1
Sample Output 2
It's a tie at round 5!
Sample Input 3
100 6
2 4 6 3
3 3 1 5
5 2 2 1
1 1 1 1
6 3 1 4
2 6 4 1
Sample Output 3
Oh no!
Explanation for Sample Outputs
For the first test case, after round 2, team one earns 17 points and team 2 earns 23 points. Since both castles only have 20 pieces each, team 2 will win.
For the second test case, there are 30 pieces in each castle and both teams reach 30 points or more at round 5 (46 vs 30). As a result, it's a tie.
For the third test case, after 6 rounds, team 1 earns 58 points and team
2 earns 32 points. Neither of them achieved 100 points to defeat the
other team. As a result, you need to output Oh no!
.
Source of pictures and descriptions: https://www.mariowiki.com/Maths_of_Glory. You can also find more details about the game from this site.
Scoring
There are 20 test cases, 3 points each.
Comments