题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5054

Problem Description
Bob 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 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 direction 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).

 
Input
There 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 ).
 
Output
If they can meet with each other, please output "YES". Otherwise, please output "NO".
 
Sample Input
10 10 5 5
10 10 6 6
 
Sample Output
YES
NO
 
Source

官方题解:

代码例如以下:

#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(数学)的更多相关文章

  1. HDU 5054 Alice and Bob

    #include <cstdio> int main(){ int n,m,x,y; while(~scanf("%d%d%d%d",&n,&m,&am ...

  2. hdu 4111 Alice and Bob 记忆化搜索 博弈论

    Alice and Bob Time Limit: 20 Sec  Memory Limit: 256 MB 题目连接 http://acm.hdu.edu.cn/showproblem.php?pi ...

  3. hdu 4268 Alice and Bob

    Alice and Bob Time Limit : 10000/5000ms (Java/Other)   Memory Limit : 32768/32768K (Java/Other) Tota ...

  4. hdu 4268 Alice and Bob(multiset|段树)

    Alice and Bob Time Limit: 10000/5000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) T ...

  5. hdu 3660 Alice and Bob's Trip(树形DP)

    Alice and Bob's Trip Time Limit: 4000/2000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Oth ...

  6. HDU 4268 Alice and Bob 贪心STL O(nlogn)

    B - Alice and Bob Time Limit:5000MS     Memory Limit:32768KB     64bit IO Format:%I64d & %I64u D ...

  7. HDU 4268 Alice and Bob(贪心+Multiset的应用)

     题意: Alice和Bob有n个长方形,有长度和宽度,一个矩形能够覆盖还有一个矩形的条件的是,本身长度大于等于还有一个矩形,且宽度大于等于还有一个矩形.矩形不可旋转.问你Alice最多能覆盖Bo ...

  8. hdu 4111 Alice and Bob(中档博弈题)

    copy VS study 1.每堆部是1的时候,是3的倍数时输否则赢: 2.只有一堆2其他全是1的时候,1的堆数是3的倍数时输否则赢: 3.其他情况下,计算出总和+堆数-1,若为偶数,且1的堆数是偶 ...

  9. HDU 5708 Alice and Bob (博弈,找规律)

    题意: 一个无限大的棋盘,一开始在1,1,有三种移动方式,(x+1,y)(x,y+1) (x+k,y+k)最后走到nm不能走了的人算输.. 析:.我们看成一开始在(n,m),往1,1,走,所以自然可以 ...

随机推荐

  1. HSL颜色处理

    H--色调 S--饱和度 L--亮度 HSB(HSL) 色调饱和度亮度模式 以另外一种不同的理念进行色彩的调配 H色调 0~360 圆环形式 以角度表示 S 饱和度 0~1 之间的小数 L 亮度 0~ ...

  2. 提交AppStore被拒原因总结

    (1)Information Needed We began the review of your app but aren’t able to continue because we need ad ...

  3. day01_07.逻辑与字符串运算符

    &&(并且)====>发现&符号总是打错,记忆口令:&7(暗器),在数字7上面,在python中是and ||(或者)====>在python中是or . ...

  4. [python学习篇][书籍学习][python standrad library][内建类型]之数值

    数值类型 — int, float, long, complex 有四种不同的数值类型:普通整数.长整数.浮点数和复数 普通整数(或者简称整数)使用C中的long实现,其精度至少为32位(sys.ma ...

  5. AtCoder Beginner Contest 070

    我好想有点思维江化,所以我想给这个丝毫没有问题的abc也写下 A - Palindromic Number Time Limit: 2 sec / Memory Limit: 256 MB Score ...

  6. poj1985&&第四次CCF软件认证第4题 求树的直径

    Cow Marathon Time Limit: 2000MS   Memory Limit: 30000K Total Submissions: 4216   Accepted: 2137 Case ...

  7. 利用Python从文件中读取字符串(解决乱码问题)

    首先声明这篇学习记录是基于python3的. python3中,py文件中默认的文件编码就是unicode,不用像python2中那样加u,比如u'中文'. 不过在涉及路径时,比如C:\Users\A ...

  8. 【Luogu】P3232游走(高斯消元解概率)

    题目链接 参见远航之曲dalao的题解,我再写一遍的话就没啥意思了. #include<cstdio> #include<cstring> #include<algori ...

  9. [LOJ#522]「LibreOJ β Round #3」绯色 IOI(危机)

    [LOJ#522]「LibreOJ β Round #3」绯色 IOI(危机) 试题描述 IOI 的比赛开始了.Jsp 和 Rlc 坐在一个角落,这时他们听到了一个异样的声音 …… 接着他们发现自己收 ...

  10. [NOIP2009] $Hankson$ 的趣味题 (数论,gcd)

    题目链接 Solution 此题,用到的结论都是比较浅显的,但是,我竟然没想到反过来枚举... 只有50分... 被自己蠢哭... 结论比较浅显: 1.对于两个正整数\(a\),\(b\),设 \(g ...