Question link: http://acm.hdu.edu.cn/showproblem.php? PID = 1, 5054
Problem descriptionbob and Alice got separated in the square, they agreed that if they get separated, they'll meet back at the coordinate point (x, y ). unfortunately they forgot to define the origin of coordinates and the coordinate axis direction. now, Bob in the lower left corner of the square, Alice in the upper right corner of the square. bob regards the lower left corner as the origin of coordinates, rightward for positive direction of axis X, upward for positive direction of axis Y. alice regards the upper right corner as the origin of coordinates, leftward for positive ction of axis X, downward for positive direction of axis Y. assuming that square is a rectangular, length and width size is N * m. as shown in the figure:
Bob and Alice with their own definition of the coordinate system respectively, went to the coordinate point (x, y). Can they meet with each other?
Note: Bob and Alice before reaching its destination, can not see each other because of some factors (such as buildings, time poor ). inputthere are multiple test cases. please process till EOF. each test case only contains four integers: n, m and X, Y. the square size is N * m, and meet in coordinate point (x, y ). (0 <x <n <= 1000, 0 <Y <m <= 1000 ). outputif they can meet with each other, please output "yes ". otherwise, please output "no ". sample Input
10 10 5 510 10 6 6
Sample output
YESNO
Sourcebestcoder round #11 (Div. 2)
Official question:
The Code is as follows:
#include <cstdio>int main(){ int n, m; int x, y; while(~scanf("%d%d%d%d",&n,&m,&x,&y)) { if(x*2==n && y*2==m) printf("YES\n"); else printf("NO\n"); } return 0;}
HDU 5054 Alice and Bob (Mathematics)