304 North Cardinal St.
Dorchester Center, MA 02124

# Cricket Ranking CodeChef Solution

## Problem – Cricket Ranking CodeChef Solution

In a season, each player has three statistics: runs, wickets, and catches. Given the season stats of two players A and B, denoted by RW, and C respectively, the person who is better than the other in the most statistics is regarded as the better overall player. Tell who is better amongst A and B. It is known that in each statistic, the players have different values.

### Input Format

• The first line contains an integer T, the number of test cases. Then the test cases follow.
• Each test case contains two lines of input.
• The first line contains three integers R1​, W1​, C1​, the stats for player A.
• The second line contains three integers R2​, W2​, C2​, the stats for player B.

### Output Format

For each test case, output in a single line `"A"` (without quotes) if player A is better than player B and `"B"` (without quotes) otherwise.

### Constraints

• 1≤T≤1000
• 0≤R1​,R2​≤500
• 0≤W1​,W2​≤20
• 0≤C1​,C2​≤20
• R1​=R2​
• W1​=W2​
• C1​=C2​

### Sample 1:

``````Input:
3
0 1 2
2 3 4
10 10 10
8 8 8
10 0 10
0 10 0
Output:
B
A
A
``````

### Explanation:

Test Case 1: Player B is better than A in all 3 fields.

Test Case 2: Player A is better than B in all 3 fields.

Test Case 3: Player A is better than B in runs scored and number of catches.

## Cricket Ranking CodeChef Solution in Pyth 3

``````# cook your dish here
for _ in range(int(input())):
l1=list(map(int,input().split()))
l2=list(map(int,input().split()))
c,d=0,0
for i in range(3):
if l1[i]>l2[i]:
c+=1
elif l1[i]<l2[i]:
d+=1
if c>d:
print("A")
else:
print("B")``````

## Cricket Ranking CodeChef Solution in C++17

``````#include <bits/stdc++.h>
using namespace std;

int main()
{
int i,t;
cin >> t;

while (t--)
{
int a,b,c,d,e,f,g=0,h=0;
cin >> a >> b >> c;
cin >> d >> e >> f;

/*g=a+b+c;
h=d+e+f;

if((a != d) && (b != e) && (c != f) )
{
if((a+b)>(d+e) || (b+c)>(e+f) || (a+c)>(d+f) || g>h)
{
cout << "A" << endl;
}
if((a+b)<(d+e) || (b+c)<(e+f) || (a+c)<(d+f) || g<h)
{
cout << "B" << endl;
}
}*/

if(a>d)
{
g++;
}
else
{
h++;
}
if(b>e)
{
g++;
}
else
{
h++;
}
if(c>f)
{
g++;
}
else
{
h++;
}

if (g>h)
{
cout << "A" << endl;
}
else
{
cout << "B" << endl;
}
}
return 0;
}
``````

## Cricket Ranking CodeChef Solution in Java

``````/* 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 r1 = sc.nextInt();
int w1 = sc.nextInt();
int c1 = sc.nextInt();
int r2 = sc.nextInt();
int w2 = sc.nextInt();
int c2 = sc.nextInt();

int count1 =0;
int count2 = 0;

if(r1 > r2)
count1++;
else
count2++;

if(w1 > w2)
count1++;
else
count2++;

if(c1 > c2)
count1++;
else
count2++;

if(count1 > count2)
System.out.println("A");
else
System.out.println("B");

T--;
}
}
}
``````
##### Cricket Ranking CodeChef Solution Review:

In our experience, we suggest you solve this Cricket Ranking 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 Cricket Ranking CodeChef Solution

Find on CodeChef

##### Conclusion:

I hope this Cricket Ranking 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 >>

LeetCode Solutions

Hacker Rank Solutions

CodeChef Solutions