Chef and Remissness
All submissions for this problem are available.
Read problems statements in Mandarin Chinese and Russian as well.
Chef is now a corporate person. He has to attend office regularly. But chef does not want to go to office, rather he wants to stay home and discover different recipes and cook them.
In the office where 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 hour in a day, but sometimes they fall asleep during their duty and could not track the entry of a person in the office building. But one better 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 boss of Chef wants to calculate how many times Chef has entered into the building. He asked to the guard and they give him two integers A and B, 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.
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.
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.
- 1 ≤ T ≤ 100
- 0 ≤ A, B ≤ 1000000
Input: 1 19 17 Output: 19 36
|Tags||cakewalk, cook43, shiplu|
|Time Limit:||1 sec|
|Source Limit:||50000 Bytes|
|Languages:||C, CPP14, JAVA, PYTH, PYTH 3.5, CS2, PAS fpc, PAS gpc, RUBY, PHP, GO, NODEJS, HASK, SCALA, D, PERL, FORT, WSPC, ADA, CAML, ICK, BF, ASM, CLPS, PRLG, ICON, SCM qobi, PIKE, ST, NICE, LUA, BASH, NEM, LISP sbcl, LISP clisp, SCM guile, JS, ERL, TCL, PERL6, TEXT, CLOJ, FS|
Fetching successful submissions
If you are still having problems, see a sample solution here.