#K75987. Minimum Moves to Reach the Treasure
Minimum Moves to Reach the Treasure
Minimum Moves to Reach the Treasure
You are given a starting point and a treasure point on a 2D plane with integer coordinates. In one move, you can move horizontally or vertically by one unit. Your task is to determine the minimum number of moves required to travel from the starting point to the treasure point. This value is simply the Manhattan distance between the two points.
Formally, if the starting point is \( (s_x, s_y) \) and the treasure point is \( (t_x, t_y) \), the answer is given by:
[ \text{moves} = |t_x - s_x| + |t_y - s_y| ]
You need to handle multiple test cases. In each test case, you will be provided with four integers representing \( s_x, s_y, t_x, t_y \).
inputFormat
The first line contains an integer \( T \) representing the number of test cases.
Each of the following \( T \) lines contains four integers \( s_x, s_y, t_x, t_y \) separated by spaces.
You should read the input from standard input (stdin).
outputFormat
For each test case, output a single integer on a new line — the minimum number of moves required to reach the treasure point from the starting point. The output should be written to standard output (stdout).
## sample3
0 0 2 2
1 1 3 3
5 5 5 8
4
4
3
</p>