Determine Pythagoras' Position for Parallelogram Formation
Euclid, Pythagoras, Pascal, and Monte decide to gather in a park. Initially, Pascal, Monte, and Euclid choose three different spots. Pythagoras, arriving later, selects a position such that when his point and the others are joined, they form a parallelogram. Specifically, the positions of Euclid and Monte will form one diagonal of this parallelogram.
Your role is to calculate Pythagoras' coordinates so the four positions create a parallelogram.
Input:
The first line provides an integer T, representing the number of test cases. For each test case, the line contains six space-separated integers: x1, y1, x2, y2, x3, y3.
- x1, y1: Coordinates of Euclid
- x2, y2: Coordinates of Pascal
- x3, y3: Coordinates of Monte
Output:
Output the coordinates of Pythagoras as two space-separated integers for each test case.
Example:
Input:
T = 1
x1 = 2, y1 = 3, x2 = 4, y2 = 5, x3 = 6, y3 = 7
Output:
x = 8, y = 9
[Calculation shows how to achieve this.]
Constraints:
- 1 <= T <= 10^2
- -10^9 <= x1, y1, x2, y2, x3, y3 <= 10^9
- Time Limit: 1sec
Note:
The coordinates of Pythagoras are uniquely determined by the other three coordinates.

AnswerBot
4mo
Calculate Pythagoras' coordinates to form a parallelogram with Euclid, Pascal, and Monte.
Calculate the midpoint of the line segment between Euclid and Monte to get the coordinates of Pythagoras.
Use th...read more
Help your peers!
Add answer anonymously...
Wipro Software Engineer interview questions & answers
A Software Engineer was asked 1mo agoQ. Explain the concept of red-black trees.
A Software Engineer was asked 2mo agoQ. What are the key components in ADF?
A Software Engineer was asked 2mo agoQ. What is a function in Python?
Popular interview questions of Software Engineer
A Software Engineer was asked 1mo agoQ1. Explain the concept of red-black trees.
A Software Engineer was asked 2mo agoQ2. What are the key components in ADF?
A Software Engineer was asked 2mo agoQ3. What is a function in Python?
Top HR questions asked in Wipro Software Engineer
A Software Engineer was asked 1w agoQ1. What is your goal?
A Software Engineer was asked 3w agoQ2. How do you handle stress?
A Software Engineer was asked 3w agoQ3. What motivates you?
Stay ahead in your career. Get AmbitionBox app


Trusted by over 1.5 Crore job seekers to find their right fit company
80 L+
Reviews
10L+
Interviews
4 Cr+
Salaries
1.5 Cr+
Users
Contribute to help millions
AmbitionBox Awards
Get AmbitionBox app

