Penalty Shots solution codechef
It’s the soccer match finals in Chefland and as always it has reached the penalty shotouts. Each team is givenshots to make and the team scoring a goal on the maximum number of shots wins the game. If both the teams’ scores are equal, then the game is considered a draw and we would have champions.
Given ten integers, where the odd indexed integers( ) represent the outcome of the shots made by team and even indexed integers( ) represent the outcome of the shots made by team (here indicates that it’s a goal and indicates a miss), determine the winner or find if the game ends in a draw.
Input Format Penalty Shots solution codechef
- The first line of input contains a single integer denoting the number of test cases. The description of test cases follows.
- The first and only line of each test case contains ten space-separated integers .
Output Format Penalty Shots solution codechef
For each test case, print a single line containing one integer –if the game ends in a draw or if the first team wins or if the second team wins.
Constraints Penalty Shots solution codechef
Sample Input 1
4 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 1 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 0
Sample Output 1
0 2 1 1
Test case: No team scores any goal, so the game ends in a draw.
Test case: The second team is able to score in their final shot, while the first team has scored 0 goals and hence the second team wins.
Test case: The first team is successfully able to make their first shots count and whereas the second team has not scored any goals. Therefore the first team wins.
Test case: Team misses their final shot and hence team wins the game with the final score of .
Solution: Click here