My issue
My code
// Update your code below to solve the problem
#include <bits/stdc++.h>
using namespace std;
int main()
{
int t;
cin >> t;
int team_1 = 0;
int team_2 = 0;
while(t--)
{
int A[10];
for(int i = 0; i < 10; i++)
{
cin >> A[i];
}
for (int i=0; i<10; i++ )
{
if ((i%2 == 0) && A[i] != 0)
{
team_1 = team_1 + 1;
}
else if ((i%2 != 0) && A[i] != 0)
{
team_2 = team_2 +1;
}
}
if (team_2 > team_1)
{
cout << 2 << endl;
}
else if (team_1 > team_2)
{
cout << 1 << endl;
}
else
{
cout << 0 << endl;
}
}
return 0;
}
Learning course: C++ for problem solving - 2
Problem Link: CodeChef: Practical coding for everyone