今天,pasher打算在一个浪漫的花园和他的搭档们聚餐,但是不幸的是,pasher忘记了花园的地点,他只记得这个花园看上去像个平行于坐标轴的正方形,他还记得花园的每个顶点上都有一棵大数。现在,pasher知道其中两棵树的坐标,且这两棵树在对角线上,你能帮他找出另外两棵树的坐标吗?
0 0 1 1
0 1 1 0
ac代码:
#include <iostream> #include <cmath> using namespace std; int main(){ int x1,x2,y1,y2; while(cin>>x1>>y1>>x2>>y2){ if(abs(x1-x2)==abs(y1-y2)&&x1!=x2&&y1!=y2){ if(x1>x2){ cout<<x2<<" "<<y1<<" "<<x1<<" "<<y2<<'\12'; }else{ cout<<x1<<" "<<y2<<" "<<x2<<" "<<y1<<'\12'; } }else cout<<-1<<'\12'; } return 0; }
运行结果: