计蒜客————Anniversary Cake
来源:互联网 发布:数码宝贝网络侦探进化 编辑:程序博客网 时间:2024/06/09 18:03
- 21.08%
- 2000ms
- 262144K
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.
Input
The single line of the input contains six integers: w,h — cake dimensions; ax, ay — x andy coordinates of the first candle; bx, by — the coordinates of the second candle (3 ≤ w,h ≤ 109;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 n,m,x1,x2,y1,y2; while(cin>>n>>m>>x1>>y1>>x2>>y2){ if(x1==x2) cout<<"0 "<<y1<<' '<<n<<' '<<y2<<endl; else cout<<x1<<" 0 "<<x2<<' '<<m<<endl; } return 0;}
- 计蒜客————Anniversary Cake
- Anniversary Cake
- 10167—Birthday Cake
- ZOJ - 3537 —— Cake
- pku 1020 Anniversary Cake
- POJ 1020 Anniversary Cake
- poj1020--Anniversary Cake题解
- poj 1020 Anniversary Cake
- 1020 - Anniversary Cake
- POJ 1020 Anniversary Cake
- poj - 1020 - Anniversary Cake
- 1020 Anniversary Cake DFS
- POJ - 1020 Anniversary Cake
- POJ 1020 Anniversary Cake
- poj1020 Anniversary Cake 搜索
- poj_1020 anniversary cake
- poj 1020 Anniversary Cake
- Anniversary Cake POJ
- 路透:百度扎根硅谷 引领自动驾驶汽车研发
- 合唱团问题-懵逼-强行做-错-更懵逼-继续做-完成
- POJ
- Python selenium的js扩展实现
- 剑指offer——面试题7:用两个栈实现队列
- 计蒜客————Anniversary Cake
- nyoj488 素数环(dfs)
- 数据结构实验之二叉树二:遍历二叉树
- binary-tree-zigzag-level-order-traversal Java code
- 关乎到性命的问题,请一定看完
- 数据结构实验之二叉树三:统计叶子数
- python中if __name__ == '__main__': 的解析
- gojs入门
- nyoj82 迷宫寻宝(一)bfs(java)