A. Pashmak and Garden
time limit per test

1 second

memory limit per test

256 megabytes

input

standard input

output

standard output

Pashmak has fallen in love with an attractive girl called Parmida since one year ago...

Today, Pashmak set up a meeting with his partner in a romantic garden. Unfortunately, Pashmak has forgotten where the garden is. But he remembers that the garden looks like a square with sides parallel to the coordinate axes. He also remembers that there is exactly one tree on each vertex of the square. Now, Pashmak knows the position of only two of the trees. Help him to find the position of two remaining ones.

Input

The first line contains four space-separated x1, y1, x2, y2 ( - 100 ≤ x1, y1, x2, y2 ≤ 100) integers, where x1 and y1 are coordinates of the first tree and x2 and y2 are coordinates of the second tree. It's guaranteed that the given points are distinct.

Output

If there is no solution to the problem, print -1. Otherwise print four space-separated integers x3, y3, x4, y4 that correspond to the coordinates of the two other trees. If there are several solutions you can output any of them.

Note that x3, y3, x4, y4 must be in the range ( - 1000 ≤ x3, y3, x4, y4 ≤ 1000).

Sample test(s)
input
0 0 0 1
output
1 0 1 1
input
0 0 1 1
output
0 1 1 0
input
0 0 1 2
output
-1

大家好我是紫名选手T T第二次akdiv2了

第一题神模拟……有一个边和xy轴平行的正方形,给两个点,要输出另两个点,不存在就输出-1

然后就是各种判断啦T T

x1==x2的时候分一类,y1==y2的时候分一类,否则是对角线的位置分一类,然后判一下-1就好了

直接把x1==x2和y1==y2的输出一大堆拷过去再改的,然后忘记交换x和y了QAQ

#include<iostream>
#include<cstdio>
#define LL long long
using namespace std;
inline int read()
{
int x=,f=;char ch=getchar();
while(ch<''||ch>''){if(ch=='-')f=-;ch=getchar();}
while(ch>=''&&ch<=''){x=x*+ch-'';ch=getchar();}
return x*f;
}
inline int abs(int a)
{return a<?-a:a;}
int x1,x2,y1,y2;
int main()
{
x1=read();y1=read();x2=read();y2=read();
if (x1==x2)
{
printf("%d %d %d %d",abs(y2-y1)+x1,y1,abs(y2-y1)+x1,y2);
}else
if (y1==y2)
{
printf("%d %d %d %d",x1,abs(x2-x1)+y1,x2,abs(x2-x1)+y1);
}else
{
if (abs(x1-x2)!=abs(y1-y2)){printf("-1");return ;}
printf("%d %d %d %d",x1,y2,x2,y1);
}
}

cf459A

cf459A Pashmak and Garden的更多相关文章

  1. CF459A Pashmak and Garden (水

    Pashmak and Garden Codeforces Round #261 (Div. 2) A. Pashmak and Garden time limit per test 1 second ...

  2. Codeforces Round #261 (Div. 2)459A. Pashmak and Garden(数学题)

    题目链接:http://codeforces.com/problemset/problem/459/A A. Pashmak and Garden time limit per test 1 seco ...

  3. Codeforce 459A - Pashmak and Garden (已知两点求另外两点构成正方形)

    Pashmak has fallen in love with an attractive girl called Parmida since one year ago... Today, Pashm ...

  4. CodeForces 459A Pashmak and Garden(水~几何-给两点求两点组成正方形)

    题目链接:http://codeforces.com/problemset/problem/459/A 题目大意: 给出两个点(在坐标轴中),求另外两个点从而构成一个正方形,该正方形与坐标轴平行. 如 ...

  5. codeforces 459 A. Pashmak and Garden 解题报告

    题目链接:http://codeforces.com/problemset/problem/459/A 题目意思:给出两个点的坐标你,问能否判断是一个正方形,能则输出剩下两点的坐标,不能就输出 -1. ...

  6. CF 459A(Pashmak and Garden-正方形给出2点求2点)

    A. Pashmak and Garden time limit per test 1 second memory limit per test 256 megabytes input standar ...

  7. New Training Table

          2014_8_15 CodeForces 261 DIV2 A. Pashmak and Garden 简单题   B. Pashmak and Flowers    简单题   C. P ...

  8. CF 459A && 459B && 459C && 459D && 459E

    http://codeforces.com/contest/459 A题 Pashmak and Garden 化简化简水题,都告诉平行坐标轴了,数据还出了对角线,后面两个点坐标给的范围也不错 #in ...

  9. Codeforces Round #261 (Div. 2)[ABCDE]

    Codeforces Round #261 (Div. 2)[ABCDE] ACM 题目地址:Codeforces Round #261 (Div. 2) A - Pashmak and Garden ...

随机推荐

  1. IE input X 去掉文本框的叉叉和密码输入框的眼睛图标

    从IE 10开始,type="text" 的 input 在用户输入内容后,会自动产生一个小叉叉(X),方便用户点击清除已经输入的文本对于type="password&q ...

  2. css案例学习之div+a实现菜单

    效果 代码 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w ...

  3. toolkit,phonetextbox中实现用户按回车键会换行

    今天,了解到一个需求,要在输入框中实现:用户按回车键后换行 输入框是toolkit中的phonetextbox 1.首先google了一下,了解到有MultiLine这个属性,但是找寻了一番之后,居然 ...

  4. 剑指offer-面试题22.栈的压入,弹出序列

    题目:输入两个整数序列,第一个序列表示栈的压入顺序,请判断第 二个序列是否为该栈的弹出顺序.假设压入栈的所有数字均不相等. 例如序列1.2.3.4.5是某栈的压栈序列,序列4.5.3.2.1 是该压栈 ...

  5. gdb 调试coredump文件过程

    gdb 调试coredump文件过程: 第一步:首先需要一个进程的coredump文件,怎么搞出coredump文件呢? 1. ps -fax|grep                 进程名称 找到 ...

  6. FP-Growth算法之频繁项集的挖掘(python)

    前言: 关于 FP-Growth 算法介绍请见:FP-Growth算法的介绍. 本文主要介绍从 FP-tree 中提取频繁项集的算法.关于伪代码请查看上面的文章. FP-tree 的构造请见:FP-G ...

  7. 标准linuxserver搭建

    一:针对大数据平台的linux例如以下搭建.为了方便截图,採用的虚拟机,与真实环境有点出入 二:过程例如以下 1. 在vmware中选择载入虚拟光盘iso文件,然后进入安装 2. 默认选择第一项 In ...

  8. ubuntu下安装xlrd模块,Mysqldb模块

    Python中安装xlrd模块 1.从 https://pypi.python.org/pypi/xlrd  下载压缩包 2.解压所下载的压缩包 3.CD到解压文件夹,运行 sudo python s ...

  9. cocos2d-x绑定ccb文件

    首先,ccb文件是如何生成的,我就不多说了,大家可以搜下cocosbuilder,就能找的相关的教程,而通过cocosbuilder,我们可以省去了很多设计的麻烦,比如设计一个精灵的位置啥的,而通过c ...

  10. qt获取本机网络信息

    networkinformation.h #include<QtGui/QWidget> #include<QLabel> #include<QPushButton> ...