HDU 5054 Alice and Bob (Mathematics)

Source: Internet
Author: User

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)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.