CodechefApr 05, 2025

Difficulty 571 : Car or Bike

Hazrat Ali

Codechef

Car or Bike

Chef wants to reach home as soon as possible. He has two options:

  • Travel with his BIKE which takes XX minutes.
  • Travel with his CAR which takes YY minutes.

Which of the two options is faster or do they both take same time?

Input Format

  • First line will contain TT, number of test cases. Then the test cases follow.
  • Each test case contains a single line of input, two integers X,YX,Y representing the time taken to travel with BIKE and CAR respectively.

Output Format

For each test case, print CAR if travelling with Car is faster, BIKE if travelling with Bike is faster, SAME if they both take the same time.

You may print each character of CARBIKE and SAME in uppercase or lowercase (for example, CARCarcAr will be considered identical).

Constraints

  • 1≤T≤100
  • 1≤X,Y≤10

Sample 1:

Input
 
Output
 
3
1 5
4 2
6 6
BIKE
CAR
SAME

Explanation:

Test case-1: Travelling with BIKE takes 11 minute while travelling with CAR takes 55 minutes. So travelling with BIKE is faster.

Test case-2: Travelling with BIKE takes 44 minutes while travelling with CAR takes 22 minutes. So travelling with CAR is faster.

Test case-3: Travelling with both BIKE and CAR takes the SAME time i.e. 66 minutes.

 

Solution :

h=int(input())
for i in range(h):
    x,y=map(int,input().split())
    if x>y:
        print("CAR")
    elif x==y:
        print("SAME")
    else:
        print("BIKE")
        

 

 

 

 

 

Comments