[ABC246A] Four Points
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);
}
[ABC246A] Four Points的更多相关文章
- 有理数的稠密性(The rational points are dense on the number axis.)
每一个实数都能用有理数去逼近到任意精确的程度,这就是有理数的稠密性.The rational points are dense on the number axis.
- [LeetCode] Max Points on a Line 共线点个数
Given n points on a 2D plane, find the maximum number of points that lie on the same straight line. ...
- LeetCode:Max Points on a Line
题目链接 Given n points on a 2D plane, find the maximum number of points that lie on the same straight l ...
- K closest points
Find the K closest points to a target point in a 2D plane. class Point { public int x; public int y; ...
- 【leetcode】Max Points on a Line
Max Points on a Line 题目描述: Given n points on a 2D plane, find the maximum number of points that lie ...
- Max Points on a Line
Given n points on a 2D plane, find the maximum number of points that lie on the same straight line. ...
- [LeetCode OJ] Max Points on a Line
Max Points on a Line Submission Details 27 / 27 test cases passed. Status: Accepted Runtime: 472 ms ...
- [UCSD白板题] Points and Segments
Problem Introduction The goal in this problem is given a set of segments on a line and a set of poin ...
- [UCSD白板题] Covering Segments by Points
Problem Introduction You are given a set of segments on a line and your goal is to mark as few point ...
- [javascript svg fill stroke stroke-width points polygon属性讲解] svg fill stroke stroke-width points polygon绘制多边形属性并且演示polyline和polygon区别讲解
<!DOCTYPE html> <html lang='zh-cn'> <head> <title>Insert you title</title ...
随机推荐
- Python字符串操作函数split()和join()
字符串拆分 在python中有切片(Slice)操作符,可以对字符串进行截取,还提供了split()函数可以将一个 字符串分裂成多个字符串组成的列表.在使用split()函数来拆分字符串之前,我们先来 ...
- 应用程序接口(API)安全的入门指南
什么是 API? 对于初学者来说,API 是指为两个不同的应用之间实现流畅通信,而设计的应用程序编程接口.它通常被称为应用程序的"中间人".由于我们需要保护用户的持有数据. ...
- 【目标检测】RCNN算法实现
一.前言 RCNN(Regions with CNN features)算法由Ross Girshick在2014年的论文"Rich feature hierarchies for accu ...
- 监听数组Array变化或Obj属性变化
工作中经常会遇到监听数组发生变化时执行相应的回调触发逻辑,客户应用场景中需要实现对象变量的动态监听,当变量发生变化时触发回调函数,实现事件发送等应用场景. 通常由以下两种方式实现需求 一. ...
- MySQL实战实战系列 00 开篇词 这一次,让我们一起来搞懂MySQL
你好,我是林晓斌,网名"丁奇",欢迎加入我的专栏,和我一起开始 MySQL 学习之旅.我曾先后在百度和阿里任职,从事 MySQL 数据库方面的工作,一步步地从一个数据库小白成为 M ...
- dedebiz实时时间调用
{dede:tagname runphp='yes'}@me = date("Y-m-d H:i:s", time());{/dede:tagname}
- Java笔记(细碎小知识点)1
1.Dos命令:dir:打出当前目录结构:md:创建文件夹:cd+文件夹地址:跳转到当前目录下的对应文件夹:cd..:跳转到上一目录:rd+文件夹:删除文件夹中东西:del+文件(或 "*. ...
- 垃圾000000000000000000000写了很多,保存不上,发送失败了。。。。。A
垃圾000000000000000000000写了很多,保存不上,发送失败了.....A垃圾000000000000000000000写了很多,保存不上,发送失败了.....A垃圾0000000000 ...
- JAVA图搜索算法之DFS-BFS
图算法DFS与BFS BFS和DFS代表对图进行遍历,即搜索的算法,搜索算法中常用的只要有两种算法:深度优先遍历(Depth-First-Search : DFS)和广度优先遍历(Breadth-Fi ...
- UVA10054 The Necklace 题解
好可恶一道题,怎么没人告诉我输出之间有空行( 思路是先抽象成图,然后跑一边dfs记录边的前后顺序. 对于不能成环的情况,只需要再开个数组记录度数判断奇点即可. 若存在奇点则break掉,剩下的跑dfs ...