【链接】 我是链接,点我呀:)

【题意】

题意

【题解】

因为gcd(a,b)=x
所以设a = n*x b = m*x
又有a*b/gcd(a,b)=lcm(a,b)=y
则n*m*x = y
即n*(m*x)=y
所以枚举y的因子n
算出对应的y/n是否为x的倍数
如果是的话,则算出n,m的具体值
然后对于ab不加(避免重复计数)

【代码】

#include <bits/stdc++.h>
#define ll long long
using namespace std; ll l,r,x,y;
/*
a = n*x
b = m*x a*b/x = y
n*m*x = y
n*(m*x) = y
*/ bool in_range(ll x){
if (x>=l && x<=r) return true;
return false;
} int main(){
ios::sync_with_stdio(0),cin.tie(0);
cin >> l >> r >> x >> y;
ll len = sqrt(y);
ll ans = 0;
for (ll n = 1;n <= len;n++)
if (y%n==0){
ll temp = y/n;
if (temp%x==0){
ll m = temp/x;
ll a = n*x;
ll b = m*x;
if (a>b) continue; if (__gcd(a,b)==x && in_range(a) && in_range(b)){
if (a==b) ans++;else ans+=2;
}
}
}
cout<<ans<<endl;
return 0;
}

【Codeforces 992B】Nastya Studies Informatics的更多相关文章

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

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

  2. 【codeforces 415D】Mashmokh and ACM(普通dp)

    [codeforces 415D]Mashmokh and ACM 题意:美丽数列定义:对于数列中的每一个i都满足:arr[i+1]%arr[i]==0 输入n,k(1<=n,k<=200 ...

  3. Nastya Studies Informatics

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

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

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

  5. 【55.70%】【codeforces 557A】Ilya and Diplomas

    time limit per test1 second memory limit per test256 megabytes inputstandard input outputstandard ou ...

  6. 【35.02%】【codeforces 734A】Vladik and flights

    time limit per test2 seconds memory limit per test256 megabytes inputstandard input outputstandard o ...

  7. 【codeforces 707E】Garlands

    [题目链接]:http://codeforces.com/contest/707/problem/E [题意] 给你一个n*m的方阵; 里面有k个联通块; 这k个联通块,每个连通块里面都是灯; 给你q ...

  8. 【codeforces 707C】Pythagorean Triples

    [题目链接]:http://codeforces.com/contest/707/problem/C [题意] 给你一个数字n; 问你这个数字是不是某个三角形的一条边; 如果是让你输出另外两条边的大小 ...

  9. 【codeforces 709D】Recover the String

    [题目链接]:http://codeforces.com/problemset/problem/709/D [题意] 给你一个序列; 给出01子列和10子列和00子列以及11子列的个数; 然后让你输出 ...

随机推荐

  1. Linux下 FACL详解

    1. 什么是ACL ACL即Access Control List 主要的目的是提供传统的owner,group,others的read,write,execute权限之外的具体权限设置 ACL可以针 ...

  2. 0626-TP整理二(调试模式,空操作,跨控制器调用,跨方法跳转--redirect(),框架语法,创建model模型)

    一.调试模式(入口文件:index.php) define('APP_DEBUG', true);  //调试模式 define('APP_DEBUG', FALSE);  //运行模式 开启日志信息 ...

  3. bzoj 1584: [Usaco2009 Mar]Cleaning Up 打扫卫生【dp】

    参考:http://hzwer.com/3917.html 好神啊 注意到如果分成n段,那么答案为n,所以每一段最大值为\( \sqrt{n} \) 先把相邻并且值相等的弃掉 设f[i]为到i的最小答 ...

  4. eccharts-gl 3D立体柱状图

    echarts-gl继承于echarts echarts-gl官方实例https://echarts.baidu.com/examples/index.html#chart-type-globe 代码 ...

  5. [W3School]JavaScript教程学习

    JavaScript 简介 JavaScript 是世界上最流行的编程语言.这门语言可用于 HTML 和 web,更可广泛用于服务器.PC.笔记本电脑.平板电脑和智能手机等设备. JavaScript ...

  6. 377 Combination Sum IV 组合之和 IV

    Given an integer array with all positive numbers and no duplicates, find the number of possible comb ...

  7. Roslyn导致发布网站时报错:编译失败

    最近新升级了Visual Studio 2017,创建的Web项目Bin目录中多了一个叫roslyn的文件夹,该文件夹导致网站在某些服务器上发布出错 从网上搜索了一下,Roslyn是新出的动态编译工具 ...

  8. HTTP、HTTP1.0、HTTP1.1、HTTP2.0——笔记

    笔记来源地址:https://mp.weixin.qq.com/s/T2IErLDxbWP1a-VbRkZZHg HTTP: HTTP是WWW数据通信的基础,是应用层协议. HTTP是干什么的?用来给 ...

  9. 6.15 分解IP地址

    问题:将一个IP地址字段分解到列中,考虑下面列出的IP地址: 111.22.3.4 要得到如下所示的查询结果: +-----+----+---+---+| a   | b  | c | d |+--- ...

  10. 【转】Go语言入门教程(一)Linux下安装Go

    说明 系统是Ubuntu. 关于安装 下载安装包 当前官方下载地址是https://golang.org/dl/,如果不能访问,请自行FQ,FQ是技术工作者的必备技能. 安装 tar -xzvf go ...