304 North Cardinal St.
Dorchester Center, MA 02124

Best of Two CodeChef Solution

Problem – Best of Two CodeChef Solution

Chef took an examination two times. In the first attempt, he scored XX marks while in the second attempt he scored YY marks. According to the rules of the examination, the best score out of the two attempts will be considered as the final score.

Determine the final score of the Chef.

Input Format

• The first line contains a single integer TT — the number of test cases. Then the test cases follow.
• The first line of each test case contains two integers XX and YY — the marks scored by Chef in the first attempt and second attempt respectively.

Output Format

For each test case, output the final score of Chef in the examination.

Constraints

• 1 \leq T \leq 10001≤T≤1000
• 0 \le X, Y \le 1000≤X,Y≤100

Sample 1:

Input: 4
40 60
67 55
50 50
1 100

Output: 60
67
50
100

Explanation:

Test Case 1: The best score out of the two attempts is 6060.

Test Case 2: The best score out of the two attempts is 6767.

Test Case 3: The best score out of the two attempts is 5050.

Best of Two CodeChef Solution in Python3

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

Best of Two CodeChef Solution in C++14

#include <iostream>
using namespace std;

int main() {
int n;
cin>>n;
while(n--){
int x,y;
cin>>x>>y;

if (x>y)
cout<<x<<endl;
else
cout<<y<<endl;
}
return 0;
}


Best of Two 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();
for (int i=0;i<t ;i++ ){
int x = sc.nextInt();
int y = sc.nextInt();
if(x>=y){
System.out.println(x);
}
else{
System.out.println(y);
}
}

}
}

Best of Two CodeChef Solution Review:

In our experience, we suggest you solve this Best of Two 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 Best of Two CodeChef Solution

Find on CodeChef

Conclusion:

I hope this Best of Two 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