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. 优盘文件系统(FOR C)

    优盘上的数据按照其不同的特点和作用大致可分为5 部分:MBR 区.DBR 区.FAT 区.FDT区和DATA 区. 主引导记录(MBR) 绝对扇区号为:MBR_LBA=0x00000000 处是主引导 ...

  2. java.net.SocketTimeoutException: Read timed out

    If you get java.net.SocketTimeoutException: Read timed out exception Try setting own timeout value w ...

  3. LeeCode-Linked List Cycle

    Given a linked list, determine if it has a cycle in it. /** * Definition for singly-linked list. * s ...

  4. LeeCode-Same Tree

    Given two binary trees, write a function to check if they are equal or not. Two binary trees are con ...

  5. ListView开发笔记

    一.ListView有背景,ListItem 透明,但是在点击.拖动时变成白色 android:cacheColorHint="#0000"

  6. convertView

    [convertView] 参考:https://zhidao.baidu.com/question/423895201122905772.html

  7. Java中对象的三种状态

    Java中的对象的三种状态是和垃圾回收紧密相关的,因此有必要深究. 状态一:可触及态:从根节点开始,可以搜索到这个对象,也就是可以访问到这个对象,也有人将其称为可达状态. 状态二:可复活态:从根节点开 ...

  8. Java——单例设计模式

    设计模式:解决某一类问题最行之有效的方法.Java中23种设计模式:单例设计模式:解决一个类在内存中只存在一个对象. 想要保证对象唯一.1,为了避免其他程序过多建立该类对象.先禁止其他程序建立该类对象 ...

  9. <转>maven发布第三方jar的一些问题

    在创建maven中私有仓库过程中,需要发布一些第三方jar到nexus仓库,使用命令的是 deploy:deploy-file 有许多参数,具体可查看 http://maven.apache.org/ ...

  10. java二维码之利用谷歌的zxing生成二维码,解析二维码

    生成二维码 @RequestMapping("/123") public void test(HttpServletRequest request,HttpServletRespo ...