有增长姿势了

  如果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. hdu1285确定比赛名次(拓扑排序+优先队列)

    传送门 第一道拓扑排序题 每次删除入度为0的点,并输出 这题要求队名小的排前面,所以要用到重载的优先队列 #include<bits/stdc++.h> using namespace s ...

  2. Java字符串与日期互转

    Java字符串与日期的相互转换 1.字符串转日期 字符串的格式与日期的格式一定要对应,并且字符串格式可以比日期格式多,但不能少,数字大小不自动计算日期.其中需要主要大小写 年yyyy 月MM 日dd ...

  3. 高可用OpenStack(Queen版)集群-15.Glance&Cinder集成Ceph

    参考文档: Install-guide:https://docs.openstack.org/install-guide/ OpenStack High Availability Guide:http ...

  4. React Native移动开发实战-3-实现页面间的数据传递

    React Native使用props来实现页面间数据传递和通信.在React Native中,有两种方式可以存储和传递数据:props(属性)以及state(状态),其中: props通常是在父组件 ...

  5. 我对BP网络的简单的理解

    最近在学习tf的神经网络算法,十多年没有学习过数学了,本来高中数学的基础,已经彻底还给数学老师了.所以我把各种函数.公式和推导当做黑盒子来用,理解他们能做到什么效果,至于他们是如何做到的,暂时不去深究 ...

  6. PHP XXE漏洞

    PHP xml 外部实体注入漏洞(XXE) 1.环境 PHP 7.0.30Libxml 2.8.0Libxml2.9.0 以后 ,默认不解析外部实体,对于PHP版本不影响XXE的利用 2.原理介绍 X ...

  7. RBC:Echo设备2020年可为亚马逊贡献100亿美元收入

    BI 中文站 12 月 22 日报道 加拿大皇家银行资本市场(RBC Capital Markets)分析师马克-马哈尼(Mark Mahaney)表示,亚马逊是首批将智能音箱引进主流受众的公司之一, ...

  8. head和tail命令详解

    基础命令学习目录首页 原文链接:https://www.cnblogs.com/amosli/p/3496027.html 当要查看上千行的大文件时,我们可不会用cat命令把整个文件内容给打印出来,相 ...

  9. Python序列之元组 (tuple)

    作者博文地址:http://www.cnblogs.com/spiritman/ Python的元组与列表类似,同样可通过索引访问,支持异构,任意嵌套.不同之处在于元组的元素不能修改.元组使用小括号, ...

  10. JSBridge的原理

    前言 参考来源 前人栽树,后台乘凉,本文参考了以下来源 github-WebViewJavascriptBridge JSBridge-Web与Native交互之iOS篇 Ios Android Hy ...