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 ...
随机推荐
- ThinkPHP学习笔记(一)----初识ThinkPHP
在做微信开发的时候原本使用来yii框架,后续觉得yii虽然功能强大使用方便,但是整个框架太大了,不适合一些轻量级的开发:这个时候发现thinkphp这个框架,框架本身很小,只有几M,但麻雀虽小,但五脏 ...
- jmeter线程组介绍
Jmeter中的测试计划是一直有的,但可以在右侧修改名字,要开始做具体测试设计前,都需要在测试计划下边添加一个线程组,添加路径为鼠标捕获测试计划后,点击鼠标右键->添加->Threads( ...
- Linux命令的那些事(二)
回顾Linux(一) 学习了以下命令: mkdir/rmdir/ls/rm/pwd/cd/touch/tree/man/--help 想具体了解请看上一篇文章跳转 在Linux中推荐大家使用subli ...
- numastat命令详解
基础命令学习目录 作者:[吴业亮]博客:http://blog.csdn.net/wylfengyujiancheng一.系统架构的演进从SMP到NUMA1.SMP(Symmetric Multi-P ...
- React的setState分析
前端框架层出不穷,不过万变不离其宗,就是从MVC过渡到MVVM.从数据映射到DOM,angular中用的是watcher对象,vue是观察者模式,react就是state了. React通过管理状态实 ...
- CF 1095C Powers Of Two(二进制拆分)
A positive integer xx is called a power of two if it can be represented as x=2y, where y is a non-ne ...
- web153
电影网站:www.aikan66.com 项目网站:www.aikan66.com 游戏网站:www.aikan66.com 图片网站:www.aikan66.com 书籍网站:www.aikan66 ...
- Codeforces Round #235 (Div. 2) D. Roman and Numbers 状压dp+数位dp
题目链接: http://codeforces.com/problemset/problem/401/D D. Roman and Numbers time limit per test4 secon ...
- Parallel学习
Parallel给cpu的核有关系,在Parallel中,写入需要并行执行的方法,比如:方法1需要3秒:方法2需要6秒:方法3需要9秒: 并行情况下,加上任务分配,上下文切换需要1秒,执行方法总耗时只 ...
- Good Time 冲刺 一
2018/6/14 我们组之前没有开发小程序的经验,所以在尝试中不断探索与学习.在完成小程序的初步注册和界面完善后,我们组开始进行开发任务. 1.1成员简述: 王怡镔:“今天主要学习小程序开发知识及相 ...