**Physical Address**

304 North Cardinal St.

Dorchester Center, MA 02124

It’s the soccer match finals in Chefland and as always it has reached the penalty shotouts. Each team is given 5 shots 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 2 champions.

Given ten integers *A*1,*A*2,…,*A*10, where the odd indexed integers(*A*1,*A*3,*A*5,*A*7,*A*9) represent the outcome of the shots made by team 1 and even indexed integers(*A*2,*A*4,*A*6,*A*8,*A*10) represent the outcome of the shots made by team 2 (here *A**i*=1 indicates that it’s a goal and *A**i*=0 indicates a miss), determine the winner or find if the game ends in a draw.

- The first line of input contains a single integer
*T*denoting the number of test cases. The description of*T*test cases follows. - The first and only line of each test case contains ten space-separated integers
*A*1,*A*2,…,*A*10.

For each test case, print a single line containing one integer – 0 if the game ends in a draw or 1 if the first team wins or 2 if the second team wins.

- 1≤
*T*≤1024 - 0≤
*A**i*≤1

```
Input:
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
Output:
0
2
1
1
```

**Test case 1:** No team scores any goal, so the game ends in a draw.

**Test case 2:** 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 3:** The first team is successfully able to make their first 2 shots count and whereas the second team has not scored any goals. Therefore the first team wins.

**Test case 4:** Team 2 misses their final shot and hence team 1 wins the game with the final score of 5−4.

```
/* package codechef; // don't place package name! */
import java.util.*;
import java.lang.*;
import java.io.*;
/* Name of the class has to be "Main" only if the class is public.
*/
class Codechef
{
public static void main (String[] args) throws java.lang.Exception
{
Scanner sc=new Scanner(System.in);
int t=sc.nextInt();
while(t>0){
int a[]=new int[10];
for(int i=0;i<10;i++){
a[i]=sc.nextInt();
}
int te1=0;
int te2=0;
for(int i=0;i<10;i++){
if(i%2==0){
te1=a[i]+te1;
}
else{
te2+=a[i];
}
}
if(te1>te2){
System.out.println("1");
}
else if(te1<te2){
System.out.println("2");
}
else{
System.out.println("0");
}
--t;
}
}
}
```

```
# cook your dish here
t = int(input())
for _ in range(t):
lis = list(map(int,input().split()))
t1 = []
t2 = []
for i in range(10):
if i%2==0:
t1.append(lis[i])
else:
t2.append(lis[i])
s1 = sum(t1)
s2 = sum(t2)
if s1>s2:
print(1)
elif s2>s1:
print(2)
else:
print(0)
```

```
#include <iostream>
using namespace std;
int main() {
int t;
cin>>t;
while(t--)
{
int x1,y1,x2,y2,x3,y3,x4,y4,x5,y5;
cin>>x1>>y1>>x2>>y2>>x3>>y3>>x4>>y4>>x5>>y5;
int a=x1+x2+x3+x4+x5;
int b=y1+y2+y3+y4+y5;
if(a==b)
{
cout<<"0"<<endl;
}
else if(a>b)
{
cout<<"1"<<endl;
}
else
{
cout<<"2"<<endl;
}
}
return 0;
}
```

In our experience, we suggest you solve this Penalty Shots CodeChef Solution and gain some new skills from Professionals completely free and we assure you will be worth it.

If you are stuck anywhere between any coding problem, just visit Queslers to get the Penalty Shots CodeChef Solution

I hope this Penalty Shots CodeChef Solution would be useful for you to learn something new from this problem. If it helped you then don’t forget to bookmark our site for more Coding Solutions.

This Problem is intended for audiences of all experiences who are interested in learning about Data Science in a business context; there are no prerequisites.

Keep Learning!

**More Coding Solutions >>**