Chef and Remissness | Codechef solution
Problem of Chef and Remissness | Codechef solution:-
The office where the Chef works, has two guards who count how many times a person enters into the office building. Though the duty of a guard is 24 hours in a day, sometimes they fall asleep during their duty and do not track the entry of a person in the office building. But one good thing is that they never fall asleep at the same time. At least one of them remains awake and counts who enters into the office.
Now the boss of Chef wants to calculate how many times the Chef has entered into the building. The boss asked to the guard and they gave him two integers A and B, the count of first guard and second guard respectively.
Help the boss to count the minimum and maximum number of times Chef could have entered into the office building.
Input of Chef and Remissness | Codechef solution
The first line of the input contains an integer T denoting the number of test cases. The description of the T test cases follows.
Each test case consists of a line containing two space separated integers A and B.
Output
For each test case, output a single line containing two space separated integers, the minimum and maximum number of times Chef could have entered into the office building.
Constraints
- 1 ≤ T ≤ 100
- 0 ≤ A, B ≤ 1000000
Example
Input:
1
19 17
Output:
19 36
Code:-
#include <iostream> using namespace std; int main() { int t,a,b; cin>>t; while(t--) { cin>>a>>b; int min=a>b?a:b; int max=a+b; cout<<min<<" "<<max<<endl; } return 0; }
Recommended Post:
-
codechef problems:-
Wipro :-
- Update the booking ID | Wipro previous year question paper solution
- Pages in PDF
- Find the location id
- Find the odd digits
- Find the Product ID
Infytq :-
Key Points;-
Hackerrank:-
- Python : missing characters : hackerrank solution
- Python : string transformation | Hackerrank solution
- Active Traders certification test problem | Hackerrank Solution
- Usernames changes certification test problem | Hackerrank Solution
- string Representation of objects certification test hackerrank solution
- Average Function | hackerrank certification problem solution
C-tutorial:-
- Micros in C
- Pointer in c
- Function declaration
- Types of user define function
- return type of function
- 2D array
See more:-
- c program to convert specified days into years weeks and days
- Print Reverse Hollow Pyramid
- Update the booking ID | Wipro previous year question paper
- Pages in PDF | Wipro previous year question paper
- Sparse Matrix in data structure
- Find the location ID | Wipro previous year Coding question
- find the odd digits | Wipro Coding question
- Find the product id | Wipro Coding question
- Difference between static and dynamic memory allocation
- What is asymptotic Notation