有增长姿势了

  如果a * b == lcm * gcd

  那么a和b为lcm因数  这个我之前真不知道emm。。。

 

#include <bits/stdc++.h>
#define mem(a, b) memset(a, b, sizeof(a))
using namespace std;
typedef long long LL;
const int maxn = 1e6+, INF = 0x7fffffff; LL gcd(LL a, LL b)
{
return b==?a:gcd(b, a%b);
} int main()
{
LL l, r, x, y;
cin>> l >> r >> x >> y;
LL ans = x * y;
LL cnt = ;
for(LL i=; i<=sqrt(y+0.5); i++)
{
if(y % i) continue;
LL tmp = y / i;
LL t = ans / i;
if(i >= l && i <= r && t >= l && t <= r && gcd(i, t) == x)
cnt++;
if(i != tmp)
{
t = ans / tmp;
if(tmp >= l && tmp <= r && t >= l && t <= r && gcd(tmp, t) == x)
cnt++;
}
}
cout<< cnt <<endl;
return ;
}

Nastya Studies Informatics CodeForces - 992B(增长姿势)的更多相关文章

  1. Nastya Studies Informatics CodeForces - 992B (大整数)

    B. Nastya Studies Informatics time limit per test 1 second memory limit per test 256 megabytes input ...

  2. Nastya Studies Informatics

    Nastya Studies Informatics   time limit per test 1 second   memory limit per test 256 megabytes   in ...

  3. CF992B Nastya Studies Informatics 数学(因子) 暴力求解 第三道

    Nastya Studies Informatics time limit per test 1 second memory limit per test 256 megabytes input st ...

  4. CodeForces 992B Nastya Studies Informatics + Hankson的趣味题(gcd、lcm)

    http://codeforces.com/problemset/problem/992/B  题意: 给你区间[l,r]和x,y 问你区间中有多少个数对 (a,b) 使得 gcd(a,b)=x lc ...

  5. 【Codeforces 992B】Nastya Studies Informatics

    [链接] 我是链接,点我呀:) [题意] 题意 [题解] 因为gcd(a,b)=x 所以设a = nx b = mx 又有ab/gcd(a,b)=lcm(a,b)=y 则nmx = y 即n(m*x) ...

  6. Nastya and King-Shamans CodeForces - 992E (线段树二分)

    大意: 给定序列a, 单点更新, 询问是否存在a[i]等于s[i-1], s为a的前缀和, a非负 考虑到前缀和的单调性, 枚举从1开始前缀和, 找到第一个大于等于s[1]的a[i], 如果相等直接输 ...

  7. Codeforces Round #489 (Div. 2) B、C

    B. Nastya Studies Informatics time limit per test 1 second memory limit per test 256 megabytes input ...

  8. Codeforces Round #489 (Div. 2)

    A. Nastya and an Array time limit per test 1 second memory limit per test 256 megabytes input standa ...

  9. [Codeforces]Codeforces Round #489 (Div. 2)

    Nastya and an Array 输出有几种不同的数字 #pragma comment(linker, "/STACK:102400000,102400000") #ifnd ...

随机推荐

  1. VM虚拟机安装CentOS 7.0添加jdk环境

    虚拟机注册码 5A02H-AU243-TZJ49-GTC7K-3C61N 安装centos系统,网络类型选择桥接网络安装完成后vi /etc/sysconfig/network-scripts/ifc ...

  2. OpenGL(2)-窗口

    写在前面 通过本节,你可以毫不费力的--->创建一个窗口 OpenGL中窗口,即载体 导入头文件 #include <glad/glad.h> #include <GLFW/g ...

  3. 用编程方式编写Babylon格式的宇宙飞船3D模型

    使用上一篇文章(https://www.cnblogs.com/ljzc002/p/9353101.html)中提出的方法,编写一个简单的宇宙飞船3D模型,在这篇文章中对模型制作流程和数学计算步骤进行 ...

  4. dom学习要点

    Dom操作 1.文本内容操作 - innerText:操作文本 - innerHtml:操作全内容 //innerText标签: <div id='i2' ><a>土味程序员& ...

  5. 从零开始的Python学习Episode 16——模块

    一.模块 在计算机程序的开发过程中,随着程序代码越写越多,在一个文件里代码就会越来越长,越来越不容易维护. 为了编写可维护的代码,我们把很多函数分组,分别放到不同的文件里,这样,每个文件包含的代码就相 ...

  6. Beta冲刺第二周王者荣耀交流协会第五次会议

    1.立会照片 成员:王超,高远博,冉华,王磊,王玉玲,任思佳,袁玥全部到齐. master:王磊 2.时间跨度: 2017年11月21日 15:00 — 15:17,总计17分钟. 3.地点: 一食堂 ...

  7. JAVA第一次实验 ——实验楼

    北京电子科技学院(BESTI) 实     验    报     告 课程:Java程序设计 班级:1352  姓名:潘俊洋  学号:20135230 成绩:             指导教师:娄嘉鹏 ...

  8. Java面向对象程序设计

    北京电子科技学院(BESTI)                                                                                 实    ...

  9. js实现把一个页面层数据传递到另一个页面

    由于之前面试,被问到过此问题,所以今天特意整理了一下.由于自己技术水平有限,若存在错误,欢迎提出批评. 本博客整理了两种方式从一个页面层向另一个页面层传递参数. 一. 通过cookie方式 1. 传递 ...

  10. Backlog和冲刺结果以及产品Demo市场调研

    Backlog和第一阶段冲刺结果以及产品Demo 博客停更了一段时间,但是我们团队没有闲着,现在一次性汇报团队工作进度,Backlog和第一阶段冲刺结果以及产品Demo. 在一段时间的分工合作以及调整 ...