题目大意:给定两个坐标轴点,按照规则走,问两个人能否相遇。
解题思路:简单题,直接举几个例子就可以知道相遇必须满足两个人走的距离点时边长的终点。详见code。
题目来源:http://acm.hdu.edu.cn/showproblem.php?pid=5054
code:
#include <iostream>
#include <cstdio>
#include <cstring>
using namespace std;
const int MAXN = 10000;
int n,m,x,y;
int main(){
while(~scanf("%d%d%d%d",&n,&m,&x,&y)){
if(x==n-x && y==m-y) printf("YES\n");
else printf("NO\n");
}
return 0;
}
本文介绍了一道简单的编程题,题目要求根据给定的坐标判断两人是否能按照特定规则相遇。通过分析可知,当两人的起始位置分别位于坐标轴的中点时才能相遇。文章提供了ACM竞赛中的具体题目链接,并附上了简洁的C++代码实现。
850

被折叠的 条评论
为什么被折叠?



