CF1200C

题意:

问内圆和外圆分别分成n、m份,每份有标号,问是否可以从一个部分走到另一个部分,12点钟位置一定有个线。

解法:

如果有一堵墙贯穿1和2,那么会使得两边不连通。这样的墙会显然出现再n或m/最大公约数的处。

CODE:

#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm> using namespace std; #define LL long long LL n,m,q; inline LL gcd(LL a,LL b) {
return !b ? a : gcd(b,a%b);
} int main() {
scanf("%lld%lld%lld",&n,&m,&q);
LL G = gcd(n, m);
LL nn = n / G, mm = m / G;
while (q--) {
LL x1, y1, x2, y2;
scanf("%lld%lld%lld%lld",&x1,&y1,&x2,&y2);
y1--, y2--;
LL ans1, ans2;
if(x1 == 1) ans1 = y1 / nn;
else ans1 = y1 / mm;
if(x2 == 1) ans2 = y2 / nn;
else ans2 = y2 / mm;
if(ans1 == ans2) puts("YES");
else puts("NO");
}
//system("pause");
return 0;
}

CF1200C的更多相关文章

随机推荐

  1. a2 Bluebottle OS

    a2 Bluebottle OS That is a copy of original A2 Repository Also extra ISO image A2_Rev-6498_serial-tr ...

  2. Eclipse 设置代码模板

    checkstyle插件 安装 从 http://sourceforge.jp/projects/sfnet_eclipse-cs/releases/ 下载 net.sf.eclipsecs-upda ...

  3. Linux Centos7配置mysql8.0数据库

    本文转至:672530440 在此感谢博主,撒花!!! 本文主要从以下几个方面对自己在centos7 下安装mysql8过程做如下总结: CentOS7 安装mysql8 步骤: window下的Na ...

  4. 猫眼 top_100 爬取 ___只完成了第一页

    # python 3.7 from urllib.request import Request,urlopen import time,re,csv class Maoyan(object): def ...

  5. inotify和rsync实现数据实时同步

    数据的实时同步 实现实时同步 要利用监控服务(inotify),监控同步数据服务器目录中信息的变化 发现目录中数据产生变化,就利用rsync服务推送到备份服务器上 实现实时同步的方法 ino ...

  6. 【Spring】源码浅析 - ResponseEntity.ok 转载

    https://www.jianshu.com/p/1238bfb29ee1 ResponseEntity.ok具体源码

  7. python django uwsgi nginx安装

    python django uwsgi nginx安装 已安装完成python/django的情况下安装 pip install uwsgi cd /usr/share/nginx/html/ vim ...

  8. 用js刷剑指offer(矩形覆盖)

    题目描述 我们可以用21的小矩形横着或者竖着去覆盖更大的矩形.请问用n个21的小矩形无重叠地覆盖一个2*n的大矩形,总共有多少种方法? 牛客网链接 思路 依旧是斐波那契数列 2 * n的大矩形,和n个 ...

  9. mysql 创建用户并授权数据库

    create user test identified by ‘password’:password  你要创建的用户对应的密码 grant all on database.*  to  test;  ...

  10. php中float浮点型字段查询问题(数据对应不上)

    薪资表  查询员工提成时候  比如说表里面是88.8  查询出来则是89 反复调试 未果,最后查看表设计  把金额字段类型设置成float 最后换成double 解决问题!!!!