#P17181. [ICPC 2017 Hong Kong R] Fermat's Optimization Problem
[ICPC 2017 Hong Kong R] Fermat's Optimization Problem
Problem Description
Consider the error function , where means the absolute value of . Given two positive integers and , our problem is to find two positive integers and such that and the error value is minimized. There may be multiple values of and that minimize , and you may output any of them.
For example, if we are given and , then the solution is: and . This solution yields the error value .
Input Format
The first line contains the number of test cases (). Each subsequent line corresponds to a test case, which contains two positive integers () and ().
Output Format
For each test case, output the value of , , and in a line, separated by spaces.
2
3 9
3 7
6 8 1
5 6 2