Corners of a Rectangle
Submissions: 88   Accuracy:

22.73%

  Difficulty: Easy   Marks: 2

Consider a rectangle ABCD, we’re given the co-ordinates of the mid points of side AD and BC (p and q respectively) along with their length L (AD = BC = L). Now given the parameters, we need to print the co-ordinates of the 4 points A, B, C and D.

Input:
The first line of input contains an integer T denoting the number of test cases. Then T test cases follow. Each test case contains coordinates of the two mid points in 2 lines. The last line contains the integer length L.

Output:
Print the floor of the coordinates of the 4 points A,B,C and D in 4 lines.

Constraints:
1<=T<=10^5
1<=L<=10^5
1<=p,q<=L

Example:
Input:

2
1 0
1 2
2
1 1
-1 -1
2.82842712475

Output:
0, 0 
0, 2
2, 2 
2, 0
0, 2 
-2, 0
0, -2 
2, 0

** For More Input/Output Examples Use 'Expected Output' option **

Contributor: Ayush Govil
Author: Ayush Govil 1


If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.



Need help with your code? Please use ide.geeksforgeeks.org, generate link and share the link here.

to report an issue on this page.