[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 ...
随机推荐
- msvc++中的预编译头文件pch.hpp和stdafx.h
预编译头文件 在 Visual Studio 中创建新项目时,会在项目中添加一个名为 pch.h 的"预编译标头文件". (在 Visual Studio 2017 及更高版本中, ...
- 全是中文的txt文件查找特定字符并输出该行到新文件
tangshi.txt文件为全为汉唐诗 在该文件中查找指定字符 codecs库为打开中文文件的库,详情自行知乎 tangshi.txt大概十几万行,需要该文件练手的同学下方评论 要点:更改文件字符编码 ...
- 使用“文心一言”编写技术博文《搭建企业知识库:基于 Wiki.js 的实践指南》
百度于8月31日零点宣布,文心一言率先向全社会全面开放.我也是立即体验了下,感觉还不错.下面分享一下,如何使用"文心一言"写一篇技术博客. Step 01 生成文案主体 可以对文心 ...
- PowerShell收集信息及绕过PowerShell权限
PowerShell脚本的4种执行权限: Restricted:默认设置,不允许任何script运行 AllSigned:只能运行经过数字证书签名的script RemoteSigned:本地脚本不做 ...
- 位图(bitmap)原理以及实现
大家好,我是蓝胖子,我一直相信编程是一门实践性的技术,其中算法也不例外,初学者可能往往对它可望而不可及,觉得很难,学了又忘,忘其实是由于没有真正搞懂算法的应用场景,所以我准备出一个系列,囊括我们在日常 ...
- 「codechef - STRQUER」Strange Queries
link. 首先对原序列排序,考虑静态序列做法为:设 \(f(n,k\in\{0,1\})\) 为对于前 \(n\) 个数,第 \(n\) 个数否 / 是已经决策完毕的最优方案,转移即 \[\begi ...
- windows上U盘格式化失败提示系统找不到指定文件
某天同事拿来几个U盘,问需不需要,我随便看了眼还挺新的,于是插上电脑看看能否正常使用,果然无法识别,因为没有使用需求了也就放着没管了. 突然有一天要去客户现场搞私有化交付了,自己带物料,这下就派上用场 ...
- Python爬虫-IP隐藏技术与代理爬取
在进行爬虫程序开发和运行时,常常会遇到目标网站的反爬虫机制,最常见的就是IP封禁,这时需要使用IP隐藏技术和代理爬取. 一.IP隐藏技术 IP隐藏技术,即伪装IP地址,使得爬虫请求的IP地址不被目标网 ...
- JVM面试题、关键原理、JMM
boolean:占用1个字节,取值为true或false. byte:占用1个字节,范围为-128到127. short:占用2个字节,范围为-32,768到32,767. int:占用4个字节,范围 ...
- 大白话带你认识JVM(转)
转自微信公众号(JavaGuide) 前言 如果在文中用词或者理解方面出现问题,欢迎指出.此文旨在提及而不深究,但会尽量效率地把知识点都抛出来 一.JVM的基本介绍 JVM 是 Java Virtua ...