A. Treasure Hunt
time limit per test

1 second

memory limit per test

256 megabytes

input

standard input

output

standard output

Captain Bill the Hummingbird and his crew recieved an interesting challenge offer. Some stranger gave them a map, potion of teleportation and said that only this potion might help them to reach the treasure.

Bottle with potion has two values x and y written on it. These values define four moves which can be performed using the potion:

Map shows that the position of Captain Bill the Hummingbird is (x1, y1) and the position of the treasure is (x2, y2).

You task is to tell Captain Bill the Hummingbird whether he should accept this challenge or decline. If it is possible for Captain to reach the treasure using the potion then output "YES", otherwise "NO" (without quotes).

The potion can be used infinite amount of times.

Input

The first line contains four integer numbers x1, y1, x2, y2 ( - 105 ≤ x1, y1, x2, y2 ≤ 105) — positions of Captain Bill the Hummingbird and treasure respectively.

The second line contains two integer numbers x, y (1 ≤ x, y ≤ 105) — values on the potion bottle.

Output

Print "YES" if it is possible for Captain to reach the treasure using the potion, otherwise print "NO" (without quotes).

Examples
input
0 0 0 6
2 3
output
YES
input
1 1 3 6
1 5
output
NO
Note

In the first example there exists such sequence of moves:

  1.  — the first type of move
  2.  — the third type of move
#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<sstream>
#include<algorithm>
#include<queue>
#include<deque>
#include<iomanip>
#include<vector>
#include<cmath>
#include<map>
#include<stack>
#include<set>
#include<fstream>
#include<memory>
#include<list>
#include<string>
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
#define MAXN 1000009
#define N 21
#define MOD 1000000
#define INF 1000000009
const double eps = 1e-;
const double PI = acos(-1.0);
inline int sgn(double t)
{
if (abs(t - floor(t)) < eps)
return ;
else
return ;
}
int main()
{
double x1, y1, x2, y2, a, b;
cin >> x1 >> y1 >> x2 >> y2;
double x = abs(x2 - x1), y = abs(y2 - y1);
cin >> a >> b;
if (sgn((double)(x//a + y//b)) == &&
sgn((double)(y//b - x//a)) == )
printf("YES\n");
else
printf("NO\n");
}

A. Treasure Hunt Codeforces 线性代数的更多相关文章

  1. Treasure Hunt CodeForces - 979B

    After the big birthday party, Katie still wanted Shiro to have some more fun. Later, she came up wit ...

  2. Treasure Hunt

    Treasure Hunt time limit per test 1 second memory limit per test 256 megabytes input standard input ...

  3. zoj Treasure Hunt IV

    Treasure Hunt IV Time Limit: 2 Seconds      Memory Limit: 65536 KB Alice is exploring the wonderland ...

  4. POJ 1066 Treasure Hunt(线段相交判断)

    Treasure Hunt Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 4797   Accepted: 1998 Des ...

  5. ZOJ3629 Treasure Hunt IV(找到规律,按公式)

    Treasure Hunt IV Time Limit: 2 Seconds      Memory Limit: 65536 KB Alice is exploring the wonderland ...

  6. POJ 1066 Treasure Hunt(相交线段&amp;&amp;更改)

    Treasure Hunt 大意:在一个矩形区域内.有n条线段,线段的端点是在矩形边上的,有一个特殊点,问从这个点到矩形边的最少经过的线段条数最少的书目,穿越仅仅能在中点穿越. 思路:须要巧妙的转换一 ...

  7. poj1066 Treasure Hunt【计算几何】

    Treasure Hunt Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 8192   Accepted: 3376 Des ...

  8. zoj 3629 Treasure Hunt IV 打表找规律

    H - Treasure Hunt IV Time Limit:2000MS     Memory Limit:65536KB     64bit IO Format:%lld & %llu ...

  9. ZOJ 3626 Treasure Hunt I 树上DP

    E - Treasure Hunt I Time Limit:2000MS Memory Limit:65536KB Description Akiba is a dangerous country ...

随机推荐

  1. NET运用String的十八层境界

    古往今来,文本处理一直是所有编程语言的最基础的功能,也是最核心最重要的功能.任何初学者,如果想学一门编程语言,都要面对大量的文本处理.而或许有一天,即使你成了大师级的人物,也不敢说自己驾驭文本处理的能 ...

  2. eclipse中Kotlin的基础应用

    最近逛网站时无意中发现有一门新语言谈论很广-- kotlin ,能够完全兼容Java.这就引起了楼主的好奇心,据所周知,Java就是因为多平台的支持 才流行起来.OK,闲话不多说,下面看图讲代码. 1 ...

  3. sort与sorted的区别

    描述 我们需要对List进行排序,Python提供了两个方法对给定的List L进行排序 :         方法1.用对List的成员函数sort进行排序        方法2.用内置函数sorte ...

  4. [Swift通天遁地]二、表格表单-(18)快速应用多种预定义格式的表单验证

    ★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★➤微信公众号:山青咏芝(shanqingyongzhi)➤博客园地址:山青咏芝(https://www.cnblogs. ...

  5. Python 线程 的 锁

    aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAA9gAAAG7CAYAAAA41T2sAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjw ...

  6. linux上搭建svn

    参照网址:http://www.cnblogs.com/LusYoHo/p/6056377.html(如何在linux下搭建svn服务)                http://www.cnblo ...

  7. Servlet到Servlet的请求转发与重定向的区别

    Servlet跳转到另一个Servlet中: request.getRequestDispatcher().forward();代表默认的是post方法,即在被跳转的Servlet的doPost()方 ...

  8. Sqoop架构(四)

    Sqoop 架构是非常简单的,它主要由三个部分组成:Sqoop client.HDFS/HBase/Hive.Database. 下面是Sqoop 的架构图 (1)用户向 Sqoop 发起一个命令之后 ...

  9. 在 kafka 的 broke 和 client 之间加入 SSL 双向认证

    在 kafka 的 broke 和 client 之间加入 SSL 双向认证https://blog.csdn.net/hohoo1990/article/details/79110031 kafka ...

  10. dubbo之并发控制

    并发控制 配置样例 样例 1 限制 com.foo.BarService 的每个方法,服务器端并发执行(或占用线程池线程数)不能超过 10 个: <dubbo:service interface ...