You are given four diverse integer focuses p1, p2, p3 and p4 on XY matrix.    In one stage you can pick one of the focuses pi and move it in one of four ways by one. All in all, if you have picked point pi=(x,y) you can move it to (x,y+1), (x,y−1), (x+1,y) or (x−1,y).    Your objective to move

C++ for Engineers and Scientists
4th Edition
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Bronson, Gary J.
Chapter4: Selection Structures
Section: Chapter Questions
Problem 14PP
icon
Related questions
Question

Correct answer will be upvoted else Multiple Downvoted. Computer science.

You are given four diverse integer focuses p1, p2, p3 and p4 on XY matrix. 

 

In one stage you can pick one of the focuses pi and move it in one of four ways by one. All in all, if you have picked point pi=(x,y) you can move it to (x,y+1), (x,y−1), (x+1,y) or (x−1,y). 

 

Your objective to move focuses so that they will shape a square with sides corresponding to OX and OY tomahawks (a square with side 0 is permitted). 

 

What is the base number of steps you want to make such a downer? 

 

Input 

 

The principal line contains a solitary integer t (1≤t≤104) — the number of experiments. 

 

Each experiment comprises of four lines. Each line contains two integers x and y (0≤x,y≤109) — directions of one of the focuses pi=(x,y). 

 

All focuses are distinctive in one experiment. 

 

Output 

 

For each experiment, print the single integer — the base number of steps to make a square.

 

 

Expert Solution
steps

Step by step

Solved in 4 steps with 1 images

Blurred answer
Knowledge Booster
Matrix multiplication
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr