The Chessboard Distance for any two points
and on a Cartesian plane is defined as .
You are given two points and . Output their Chessboard Distance.
Note that, denotes the absolute value of integer . For example, and .
Input Format
- First line will contain , the number of test cases. Then the test cases follow.
- Each test case consists of a single line of input containing space separated integers - - as defined in the problem statement.
Output Format
For each test case, output in a single line the chessboard distance between and
Constraints
Subtasks
Subtask #1 (100 points): original constraints
Sample Input 1
3
2 4 5 1
5 5 5 3
1 4 3 3
Sample Output 1
3
2
2
Explanation
In the first case, the distance between and is .
In the second case, the distance between and is .
In the third case, the distance between and is .
No comments:
Post a Comment