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 ...
随机推荐
- Java将List<T>集合组装成树(Tree)树结构组装
把列表转换为树结构 /** * 把列表转换为树结构 * * @param originalList 原始list数据 * @param keyName 作为唯一标示的字段名称 * @return 组装 ...
- 高可用OpenStack(Queen版)集群-13.分布式存储Ceph
参考文档: Install-guide:https://docs.openstack.org/install-guide/ OpenStack High Availability Guide:http ...
- Firefox浏览器【书签工具栏】里的网址链接无法删除的解决办法
今天使用Firefox浏览器,发现有一些我从来都没有访问的网站出现在[书签工具栏], 也不知道是什么原因被添加进来的(可能是安装某个插件被插的),于是点删除,发现还删除不了,很是老火,研究了一番,把删 ...
- centos7.6 安装 openvpn--2.4.7
openvpn-server端 搭建 1,软件版本 Centos - 7.x easy-rsa - 3.0.3 OpenVPN - 2.4.7 2,安装 建议安装启用epel源,采用yum的方式安装o ...
- python数据分析系列(2)--numpy
NumPy(Numerical Python的简称)是Python数值计算最重要的基础包.大多数提供科学计算的包都是用NumPy的数组作为构建基础. NumPy的部分功能如下: ndarray,一个具 ...
- __construct 与 __destruct 区别
其实这个问法是有问题的,__construct 与 __destruct 没什么可比性,两个方法一个在对象被创建的时候触发,另一个在对象被销毁的时候触发 具体可以翻阅PHP官方手册中的 http:// ...
- Redis Jedis简介
Redis是一种基于内存类型的数据存储工具 Jedis是一个用java写的Redis数据库操作的客户端,通过Jedis,可以很方便的对redis数据库进行操作.Jedis通过Jedis Pool进行R ...
- c# 写文件注意问题及用例展示
以txt写string举例,正确代码如下: private void xie() { FileStream fs = new FileStream("1.txt", FileMod ...
- 关于datatable的数据绑定问题
最近做项目掉在数据绑定这个小坑里了,最后发现问题其实很简单,只是官方的文档描述可能不太清除导致的吧.首先贴上官网地址:http://www.datatables.club/ 关于这个插件的简单使用就不 ...
- 2018软工实践—Alpha冲刺(10)
队名 火箭少男100 组长博客 林燊大哥 作业博客 Alpha 冲鸭鸭鸭鸭鸭鸭鸭鸭鸭鸭! 成员冲刺阶段情况 林燊(组长) 过去两天完成了哪些任务 协调各成员之间的工作 测试整体软件 展示GitHub当 ...