[Solution] Maximize Difference CodeChef Solution 2022
Problem
Chef has two numbers and . He calls a pair of numbers good if it satisfies the following conditions:
Chef wants to find a good pair such that the value of is maximized. Can you help Chef? (Here represents the absolute value of ).
If there are multiple good pairs for which the value of is maximized, you can print any of them. It can be proved that under the given constraints, at least one good pair always exists.
👇👇👇👇👇
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 parameters mentioned in the statment.
Output Format
For each test case, output two integers and such that is a good pair and the value of is maximized.
Explanation:
Test case : and are the only good pairs and for both of them the value of is .
Test case : and are the good pairs out of which is maximum for and .
No comments:
Post a Comment