Algorithm


problem link :  https://www.codechef.com/problems/BESTOFTWO 

Problem

Chef took an examination two times. In the first attempt, he scored  marks while in the second attempt he scored  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  — the number of test cases. Then the test cases follow.
  • The first line of each test case contains two integers  and  — 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≤�≤1000
  • 0≤�,�≤100

Sample 1:

Input
 
Output
 
4
40 60
67 55
50 50
1 100
60
67
50
100

Explanation:

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

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

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

Code Examples

#1 Code Example with C Programming

Code - C Programming

 #include<stdio.h>
int main()
{
    int t,n,m;
    scanf("%d",&t);
    while(t--)
    {
        scanf("%d %d",&n,&m);
        printf("%d\n",n*5+m*7);
    }
} 
Copy The Code & Try With Live Editor

Input

x
+
cmd
4
40 60
67 55
50 50
1 100

Output

x
+
cmd
60
67
50
100
Advertisements

Demonstration


CodeChef solution  BESTOFTWO  - Best of Two CodeChef solution in C,C++

Previous
CodeChef solution REACHTARGET - Reach the Target Codechef solution in C,C++
Next
CodeChef solution MINHEIGHT - Roller Coaster Codechef solution in C,C++