A. Treasure Hunt Codeforces 线性代数
1 second
256 megabytes
standard input
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.
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.
Print "YES" if it is possible for Captain to reach the treasure using the potion, otherwise print "NO" (without quotes).
0 0 0 6
2 3
YES
1 1 3 6
1 5
NO
In the first example there exists such sequence of moves:
— the first type of move
— 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 线性代数的更多相关文章
- Treasure Hunt CodeForces - 979B
After the big birthday party, Katie still wanted Shiro to have some more fun. Later, she came up wit ...
- Treasure Hunt
Treasure Hunt time limit per test 1 second memory limit per test 256 megabytes input standard input ...
- zoj Treasure Hunt IV
Treasure Hunt IV Time Limit: 2 Seconds Memory Limit: 65536 KB Alice is exploring the wonderland ...
- POJ 1066 Treasure Hunt(线段相交判断)
Treasure Hunt Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 4797 Accepted: 1998 Des ...
- ZOJ3629 Treasure Hunt IV(找到规律,按公式)
Treasure Hunt IV Time Limit: 2 Seconds Memory Limit: 65536 KB Alice is exploring the wonderland ...
- POJ 1066 Treasure Hunt(相交线段&&更改)
Treasure Hunt 大意:在一个矩形区域内.有n条线段,线段的端点是在矩形边上的,有一个特殊点,问从这个点到矩形边的最少经过的线段条数最少的书目,穿越仅仅能在中点穿越. 思路:须要巧妙的转换一 ...
- poj1066 Treasure Hunt【计算几何】
Treasure Hunt Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 8192 Accepted: 3376 Des ...
- zoj 3629 Treasure Hunt IV 打表找规律
H - Treasure Hunt IV Time Limit:2000MS Memory Limit:65536KB 64bit IO Format:%lld & %llu ...
- ZOJ 3626 Treasure Hunt I 树上DP
E - Treasure Hunt I Time Limit:2000MS Memory Limit:65536KB Description Akiba is a dangerous country ...
随机推荐
- jeesite自定义主题
jeesite cms首页太丑不够逼格,然而国内有很多高大上的皮肤供你选择,那么本文就一步一步教你如何定制自己的CMS站点视图. 1.下载 jeesite 源码,并安装配置成功 2.进入jeesite ...
- codeforces——数学
codeforces 805A http://codeforces.com/problemset/problem/805/A /* 题意:输入两个整数l,r,让你找一个因子 使得[l,r]里面 ...
- JS中的面相对象
1.使用Object或对象字面量创建对象 JS中最基本创建对象的方式: var student = new Object(); student.name = "easy"; stu ...
- JSP执行原理图
- Mac使用bootcamp安装win8.1出现网卡驱动没有安装问题
问题:没有网络连接 原因:在bootcamp烧的u盘里面其实附带了驱动,只是没有自动安装 解决:D:\BootCamp\Drivers\Broadcom\BroadcomWirelessWin8x64 ...
- centos安装composer以及使用国内镜像
下载composer.phar文件 curl -sS https://getcomposer.org/installer | php 将composer.phar移动到环境变量中并且更名为compos ...
- Mysql(三):多表查询和存储程序
今天内容: ● 多表查询(内连接 外连接 子查询) ● 存储程序(存储过程 函数) 多表查询 同时从多张数据表中查取到需要的数据即是多表查询. 多表查询时,参与查询的表中每条数据进行组合,这种效果 ...
- Boost Bimap示例
#include <string> #include <iostream> #include <boost/bimap.hpp> template< clas ...
- 研磨JavaScript系列(一):回归简单
想要理解JavaScript,你得首先放下对象和类的概念,回到数据和代码的本原.编程世界只有数据和代码两种基本元素,而这两种元素又有着纠缠不清的关系.JavaScript就是把数据和代码都简化到最原始 ...
- Android Activity作为dialog对话框的使用详细介绍
Activity做为Android应用层四大组件的重要组成部分,它的灵活性.可扩性无论是在应用还是游戏方面都得到了广泛应用,本文主要介绍Activity作为dialog对话框 的使用方法进行说明. 本 ...



