P19247 [CodeChef] CHESSDIST
普及-
题目描述

The Chessboard Distance for any two points (X_{1}, Y_{1}) and (X_{2}, Y_{2}) on a Cartesian plane is defined as max(|X_{1} - X_{2}|, |Y_{1} - Y_{2}|).

You are given two points (X_{1}, Y_{1}) and (X_{2}, Y_{2}). Output their Chessboard Distance.

Note that, |P| denotes the absolute value of integer P. For example, |-4| = 4 and |7| = 7.

------ Input Format ------

  • First line will contain T, the number of test cases. Then the test cases follow.
  • Each test case consists of a single line of input containing 4 space separated integers - X_{1}, Y_{1}, X_{2}, Y_{2} - as defined in the problem statement.

------ Output Format ------

For each test case, output in a single line the chessboard distance between (X_{1}, Y_{1}) and (X_{2}, Y_{2})

------ Constraints ------

$1 ≤ T ≤ 1000$
$1 ≤ X_{1}, Y_{1}, X_{2}, Y_{2} ≤ 10^{5}$

------ 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 1 ------
- In the first case, the distance between $(2, 4)$ and $(5, 1)$ is $max(|2- 5|, |4 - 1|) = max(|-3|, |3|) = 3$.

  • In the second case, the distance between $(5, 5)$ and $(5, 3)$ is $max(|5- 5|, |5 - 3|) = max(|0|, |2|) = 2$.

  • In the third case, the distance between $(1, 4)$ and $(3, 3)$ is $max(|1- 3|, |4 - 3|) = max(|-2|, |1|) = 2$.

输入格式

见题面

输出格式

见题面

样例输入
3 2 4 5 1 5 5 5 3 1 4 3 3
样例输出
3 2 2