Description

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 integersx3, 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).

Examples
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
题意:给出两个坐标,求另外两个坐标能不能构成正方形,不行输出-1
解法:额,自己想怎么构造就怎么构造
 #include<bits/stdc++.h>
using namespace std;
int main()
{
int x1,y1,x2,y2;
cin>>x1>>y1>>x2>>y2;
if(x1!=x2&&y1!=y2)
{
if(abs(x1-x2)!=abs(y1-y2))
{
cout<<"-1";
}
else
{
cout<<x1<<" "<<y2<<" "<<x2<<" "<<y1<<endl;
}
}
else
{
if(x1==x2)
{
cout<<x1+abs(y1-y2)<<" "<<y1<<" "<<x2+abs(y1-y2)<<" "<<y2<<endl;
}
else
{
cout<<x1<<" "<<y1+abs(x1-x2)<<" "<<x2<<" "<<y2+abs(x1-x2)<<endl;
}
}
return ;
}

最新文章

  1. 配置Supervisor开机启动
  2. 【BZOJ-2599】Race 点分治
  3. JSPatch中的OC高级语法
  4. 解决Cannot change version of project facet Dynamic Web M
  5. mvc-3模型和数据(2)
  6. 63.Assignment to name ignored, since the identifier is never used
  7. ORACLE-树状数据结构获取各层级节点信息
  8. python3使用ctypes在windows中访问C和C++动态链接库函数示例
  9. python datetime模块详解
  10. UVa 514 Rails(栈的应用)
  11. python学习(26)分析ajax请求抓取今日头条cosplay小姐姐图片
  12. 使用 Nginx 和 Gunicorn 部署 Django 博客(转)
  13. asp.net core microservices 架构之分布式自动计算(三)-kafka日志同步至elasticsearch和kibana展示
  14. MIAC HW2
  15. 如何将.crt的ssl证书文件转换成.pem格式
  16. Redis学习笔记(二) ---- PHP操作Redis各数据类型
  17. poj 2253 Frogger (dijkstra最短路)
  18. Linux进程状态转换图
  19. 搭建ssm中遇到的问题
  20. hihoCoder #1763 道路摧毁

热门文章

  1. eclipse通过maven建立java se工程配置log4j,打包成zip,将jar包和配置文件分开,并以bat和sh文件启动java程序
  2. ie9浏览器中h标签的嵌套问题
  3. redis09---redis 服务器端命令
  4. 广大暑假训练1 E题 Paid Roads(poj 3411) 解题报告
  5. VC++编译说明
  6. 「NOIP2010」「LuoguP1514」引水入城
  7. 【BZOJ 3224】 普通平衡树
  8. holiday题解
  9. 【前端】CentOS 7 系列教程之四: 配置 git 服务器自动部署
  10. 移植tslib库出现selected device is not a touchscreen I understand的解决方法