[Solution] Nearest Court CodeChef Solution
Problem
Chef and Chefina are at positions and on a number line.
They both love badminton.
It is known that badminton courts are located at every integer point.
They want to find a court such that the maximum distance travelled by either of them is minimized.
Formally, suppose they choose the badminton court at position . You need to find the minimum value of across all possible choices of . Here, denotes absolute value of .
Report this minimum value.
Input Format
- The first line of input will contain a single integer , denoting the number of test cases.
- Each test case consists of two space-separated integers and .
Output Format
For each test case, output the minimum possible value of .
No comments:
Post a Comment