CF817A Treasure Hunt
思路:
起点(x1, y1),终点(x2, y2),步长(dx, -dy),(dx, dy),(-dx, -dy),(-dx, dy)。只要满足abs(x1 - x2) % dx == 0 并且 abs(y1 - y2) % dy == 0 并且 abs(x1 - x2) / dx 和abs(y1 - y2) / dy奇偶性相同即可。
实现:
#include <iostream>
#include <cstdio>
using namespace std; int main()
{
int x1, y1, x2, y2, dx, dy;
cin >> x1 >> y1 >> x2 >> y2 >> dx >> dy;
int m = abs(x1 - x2), n = abs(y1 - y2);
if (m % dx || n % dy) puts("NO");
else if ((m / dx & ) != (n / dy & )) puts("NO");
else puts("YES");
return ;
}
CF817A Treasure Hunt的更多相关文章
- 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条线段,线段的端点是在矩形边上的,有一个特殊点,问从这个点到矩形边的最少经过的线段条数最少的书目,穿越仅仅能在中点穿越. 思路:须要巧妙的转换一 ...
- Treasure Hunt
Treasure Hunt time limit per test 1 second memory limit per test 256 megabytes input standard input ...
- 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 ...
- 湖南大学ACM程序设计新生杯大赛(同步赛)I - Piglet treasure hunt Series 1
题目描述 Once there was a pig, which was very fond of treasure hunting. The treasure hunt is risky, and ...
随机推荐
- php配置(php7.3)
[PHP] ;;;;;;;;;;;;;;;;;;; ; About php.ini ; ;;;;;;;;;;;;;;;;;;; ; PHP's initialization file, general ...
- python dos2unix
有时你在windows上创建的文件拿到Linux/unix上运行会出错, 这是因为windows上有些字符如换行符在linux/unix不识别.这种情况下需要用dos2unix这个工具把文件转换成li ...
- sqlit中使用到的查询语句
近期使用sqlite查询比較多,包含连表查询等. 记录一下.以免忘记! 1.先依据时间排序后选择前十条: select * from MyBill order by createTime desc ...
- Zabbix 监控服务器
Zabbix 操作系统 :CentOS7.5 两台服务器: server端:192.168.206.6 client 端: 192.168.206.3 zabbix : 4.0 mariiadb : ...
- POJ 3260 The Fewest Coins(多重背包+全然背包)
POJ 3260 The Fewest Coins(多重背包+全然背包) http://poj.org/problem?id=3260 题意: John要去买价值为m的商品. 如今的货币系统有n种货币 ...
- 【bzoj4604】The kth maximum number
暴力 #include<algorithm> #include<iostream> #include<cstdlib> #include<cstring> ...
- 视频生成 量产 win 转 linux ffmpeg linux 安装 对批量视频的尽可能短时间生成
环境准备 Welcome to aliyun Elastic Compute Service! [root@mytest ~]# pip install baidu-aip Looking in in ...
- 解决ES集群状态异常教程(存在UNASSIGNED)
解决ES集群状态异常教程(存在UNASSIGNED)_百度经验 https://jingyan.baidu.com/article/9158e00013f787a255122843.html
- sql加一个%号是什么意思
sql%notfound 是异常SQL%ROWCOUNT SQL语句执行影响的行数SQL%FOUND SQL语句是否成功执行SQL%NOTFOUND SQL语句是否成功执行SQL%ISOPEN 游标是 ...
- P2465 [SDOI2008]山贼集团 dp
这个题是一道树形dp+状压dp二合一,先预处理每种组合会有什么额外的费用,然后在树上dp就行了. 题干: 题目描述 某山贼集团在绿荫村拥有强大的势力,整个绿荫村由N个连通的小村落组成,并且保证对于每两 ...