There is a rectangle in the $xy$-plane. Each edge of this rectangle is parallel to the $x$- or $y$-axis, and its area is not zero. Given the coordinates of three of the four vertices of this rectangle, $(x_1, y_1)$, $(x_2, y_2)$, and $(x_3, y_3)$, find the coordinates of the other vertex.Problem Statement
Constraints
Input
Input is given from Standard Input in the following format:
$x_1$ $y_1$ $x_2$ $y_2$ $x_3$ $y_3$
Output
Print the sought coordinates $(x, y)$ separated by a space in the following format:
$x$ $y$
Sample Input 1
-1 -1 -1 2 3 2
Sample Output 1
3 -1
The other vertex of the rectangle with vertices $(-1, -1), (-1, 2), (3, 2)$ is $(3, -1)$.
Sample Input 2
-60 -40 -60 -80 -20 -80
Sample Output 2
-20 -40
可以用异或找到不同的那一个。
#include<cstdio>
int x1,y1,x2,y2,x3,y3;
int main()
{
scanf("%d%d%d%d%d%d",&x1,&y1,&x2,&y2,&x3,&y3);
printf("%d %d",x1^x2^x3,y1^y2^y3);
}
标签:Sample,d%,Four,Points,Input,x3,y2,rectangle
From: https://www.cnblogs.com/mekoszc/p/16745879.html