Nastya Studies Informatics CodeForces - 992B(增长姿势)
有增长姿势了
如果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(增长姿势)的更多相关文章
- Nastya Studies Informatics CodeForces - 992B (大整数)
B. Nastya Studies Informatics time limit per test 1 second memory limit per test 256 megabytes input ...
- Nastya Studies Informatics
Nastya Studies Informatics time limit per test 1 second memory limit per test 256 megabytes in ...
- CF992B Nastya Studies Informatics 数学(因子) 暴力求解 第三道
Nastya Studies Informatics time limit per test 1 second memory limit per test 256 megabytes input st ...
- 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 ...
- 【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) ...
- Nastya and King-Shamans CodeForces - 992E (线段树二分)
大意: 给定序列a, 单点更新, 询问是否存在a[i]等于s[i-1], s为a的前缀和, a非负 考虑到前缀和的单调性, 枚举从1开始前缀和, 找到第一个大于等于s[1]的a[i], 如果相等直接输 ...
- Codeforces Round #489 (Div. 2) B、C
B. Nastya Studies Informatics time limit per test 1 second memory limit per test 256 megabytes input ...
- Codeforces Round #489 (Div. 2)
A. Nastya and an Array time limit per test 1 second memory limit per test 256 megabytes input standa ...
- [Codeforces]Codeforces Round #489 (Div. 2)
Nastya and an Array 输出有几种不同的数字 #pragma comment(linker, "/STACK:102400000,102400000") #ifnd ...
随机推荐
- ionic生成签名的APK方法总结
ionic生成签名的apk步骤如下: 1. 在项目目录下运行 ionic build android --release 先生成一个未签名的apk 2. 在项目目录下运行 keytool -genke ...
- 【Unity Shader】(六) ------ 复杂的光照(上)
笔者使用的是 Unity 2018.2.0f2 + VS2017,建议读者使用与 Unity 2018 相近的版本,避免一些因为版本不一致而出现的问题. [Unity Sha ...
- php快速上手总结
PHP作为现代热门主流的开发语言,对于那些想加入新手PHPer,从哪学起,如何学习?你必须要需要掌握PHP的基础知识,基础知识相当于重点,是不可忽视的知识.常用的功能模块,面向对象的,MVC等相关技能 ...
- selenium的基本定位方式总结
Selenium提供了8种定位方式. id name class name tag name link text partial link text xpath css selector 这8种定位方 ...
- docker私服搭建nexus3
docker私服搭建有官方的registry镜像,也有改版后的NexusOss3.x,因为maven的原因搭建了nexus,所以一并将docker私服也搭建到nexus上. nexus的安装过程就单独 ...
- Python处理PDF和Word文档常用的方法(二)
Python处理word时,需要安装和导入python-docx模块. 安装命令:pip install python-docx 导入命令:import docx 编码编写顺序:用docx.Docum ...
- proxyTable中pathWrrite的使用
proxyTable中pathWrrite的使用 proxyTable: { '/iclient': { target: 'http://xxx.xx.com/iclient/xx/xx', chan ...
- 2-Nineth Scrum Meeting20151209
任务分配 闫昊: 今日完成:商讨如何迁移ios代码到android平台. 明日任务:请假.(编译) 唐彬: 今日完成:商讨如何迁移ios代码到android平台. 明日任务:请假.(编译) 史烨轩: ...
- 提交内容到版本库:git commit
- [Elite 2008 Dec USACO]Jigsaw Puzzles
#include <iostream> #include <cstdio> #include <cstring> using namespace std; #def ...