首页 > 其他分享 >Four Points

Four Points

时间:2022-09-30 19:12:01浏览次数:44  
标签:Sample d% Four Points Input x3 y2 rectangle

Problem Statement

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.

Constraints

  • $-100 \leq x_i, y_i \leq 100$
  • There uniquely exists a rectangle with all of $(x_1, y_1)$, $(x_2, y_2)$, $(x_3, y_3)$ as vertices, edges parallel to the $x$- or $y$-axis, and a non-zero area.
  • All values in input are integers.

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

相关文章

  • the_Fourth_lesson
    1、字典的基本操作测试 执行结果:  2、函数测试代码#-*-coding:utf-8-*-"""CreatedonThuSep2214:14:002022@author:Administrator"""defgreat_u......
  • points_harris算子
    points_harris—DetectpointsofinterestusingtheHarrisoperator.points_harris:通过Harris运算检测感兴趣的点。points_harris(Image::SigmaGrad,SigmaSmoo......
  • proj_match_points_ransac 算子
    proj_match_points_ransac(Image1,Image2::Rows1,Cols1,Rows2,Cols2,GrayMatchMethod,MaskSize,RowMove,ColMove,RowTolerance,ColTolerance,Rotation,Matc......
  • 从SAP ECC升级到SAP S4HANA, 几个Key Points
    从SAPECC升级到SAPS4HANA,几个KeyPoints  自从SAP公司的拳头产品S/4HANA横空出世以来,就引起了世界范围内的众多客户以及ERP咨询业界的强烈关注。 笔者发现很......
  • CF1453D Checkpoints(期望)
    Gildongisdevelopingagameconsistingof......
  • MathProblem 68 Four weights and a scale problem
    Usingabalancescaleandfourweightsyoumustbeabletobalanceanyintegerloadfrom\(1\)to\(40\).Howmuchshouldeachofthefourweightsweigh?Solut......
  • CF76E Points
    可以把题目转换成求:\[\sum_{i=1}^{n}\sum_{j=i+1}^{n}[(x_i-x_j)^2+(y_i-y_j)^2]\]继续化简:\[=\sum_{i=1}^{n}\sum_{j=i+1}^{n}(x_i-x_j)^2......
  • 基于 .NET 6 的轻量级 Webapi 框架 FastEndpoints
    FastEndpoints 是一个基于.NET6开发的开源webapi框架,它可以很好地替代.NETMinimalAPIs和MVC,专门为开发效率而生,带来了全新的开发模式和编码体验。另外对于.N......
  • 基于 .NET 6 的轻量级 Webapi 框架 FastEndpoints
    大家好,我是等天黑。FastEndpoints 是一个基于.NET6开发的开源webapi框架,它可以很好地替代.NETMinimalAPIs和MVC,专门为开发效率而生,带来了全新的开发模式和编......
  • 题解 UVA10869 Brownie Points II
    题意平面上有若干点,\(\text{stan}\)通过一个点划了一条直线,\(\text{ollie}\)通过在这条直线上的点作了一条垂线,那么平面被分成\(4\)个象限,\(\text{stan}\)获得的分数......