Who is taller! CodeChef Solution

Problem – Who is taller! CodeChef Solution

Alice and Bob were having an argument about which of them is taller than the other. Charlie got irritated by the argument, and decided to settle the matter once and for all.

Charlie measured the heights of Alice and Bob, and got to know that Alice’s height is XX centimeters and Bob’s height is YY centimeters. Help Charlie decide who is taller.

It is guaranteed that X \neq YX=Y.

Input Format

  • The first line of input will contain an integer TT — the number of test cases. The description of TT test cases follows.
  • The first and only line of each test case contains two integers XX and YY, as described in the problem statement.

Output Format

For each test case, output on a new line \texttt{A}A if Alice is taller than Bob, else output \texttt{B}B. The output is case insensitive, i.e, both \texttt{A}A and \texttt{a}a will be accepted as correct answers when Alice is taller.

Constraints

  • 1 \leq T \leq 10001≤T≤1000
  • 100 \leq X, Y \leq 200100≤X,Y≤200
  • X \neq YX=Y

Sample 1:

Input: 1
150 160
160 150

Output: B
A

Explanation:

Test case 1: In this case, 150 \lt 160150<160 so Bob is taller than Alice.

Test case 2: In this case, 160 \gt 150160>150 so Alice is taller than Bob.

Who is taller! CodeChef Solution in Python3

for i in range(int(input())):
    a,b=map(int,input().split())
    if b>a:
        print("B")
    else:
        print("A")

Who is taller! CodeChef Solution in Java


import java.util.*;
import java.lang.*;
import java.io.*;

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=sc.nextInt();
		    int b=sc.nextInt();
		    if(a>b)
		    {
		        System.out.println("A");
		    }
		    else
		    System.out.println("B");
		}
	}
}

Who is taller! CodeChef Solution in C++17

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

int main()
{
    int t;
    cin >> t;
    while (t--) 
    {
        int x, y;
        cin >> x >> y;
        if(x>y)
            cout << "A" << endl;
        else
            cout << "B" << endl;
    }

    return 0;
}
Who is taller! CodeChef Solution Review:

In our experience, we suggest you solve this Who is taller! 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 Who is taller! CodeChef Solution

Find on CodeChef

Conclusion:

I hope this Who is taller! 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

Leave a Reply

Your email address will not be published.