Anniversary Cake

Two students, Adam and Anton, are celebrating two-year anniversary of not passing their Math Logic exam. After very careful search in a local supermarket, they bought a rectangular cake with integer dimensions and two candles.

Later in the campus Adam put the candles into different integer points of the cake and gave a knife toAnton to cut the cake. The cut should start and end at integer points at the edges of the cake, and it should not touch the candles. Also each piece should have exactly one candle at it. Please, help Anton to find the starting and ending points of the cut.

image.png

Input

The single line of the input contains six integers: w, h — cake dimensions; ax, ay — x and y coordinates of the first candle; bx, by — the coordinates of the second candle (3 ≤ w,h ≤ 10910^9109;0<ax, bx <w;0<ay,by <h;ax ̸=bx or ay ̸=by).

Output

Output four integers sx, sy, ex, and ey — the starting and ending coordinates of the cut. Both starting and ending point of the cut should belong to the sides of the cake.

If there are several solutions, output any of them. 

样例输入复制

7 3 2 2 3 2

样例输出复制

0 0 4 3

 

题目大意:

在一个方格上的交点上放置两个点,两个点不能重叠,不能放置在边上,然后在边上选两个点,使这两点的连线恰好能将之前的两个点分开,而且使之前的两个点任意一个都不能在线上

我们的做法是判断两点是否在一竖列

若不在同一竖列上,就使边上的两个点的横坐标分别为那两个点的横坐标 

 

若在同一点上,就让边上两个点在左右侧的边,并且


 

#include<iostream>
using namespace std;
int main(){
	int m,n;
	int ax,ay,bx,by;
	cin>>m>>n>>ax>>ay>>bx>>by;
	if(ax==bx){
		cout<<'0'<<' '<<ay<<' '<<m<<' '<<by<<endl;
	}else{
		cout<<ax<<' '<<'0'<<' '<<bx<<' '<<n<<endl;
	}
}

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值