题意:给你一个n,m问你1-n里面(x)有多少对gcd(x, n)>=m。

  思路:我们可以设n=a*b, x=a*c,此时我们可以知道b,c是互质的,那么就可以用欧拉来求解

/*  gyt
Live up to every day */
#include<cstdio>
#include<cmath>
#include<iostream>
#include<algorithm>
#include<vector>
#include<stack>
#include<cstring>
#include<queue>
#include<set>
#include<string>
#include<map>
#include <time.h>
#define PI acos(-1)
using namespace std;
typedef long long ll;
typedef double db;
const int maxn = 1e6+;
const ll maxm = 1e7;
const ll mod = 1e9 + ;
const int INF = 0x3f3f3f;
const ll inf = 1e15 + ;
const db eps = 1e-;
const int kind=; ll euler(ll n){
ll res=n,a=n;
for(ll i=;i*i<=a;i++){
if(a%i==){
res=res/i*(i-);
while(a%i==) a/=i;
}
}
if(a>) res=res/a*(a-);
return res;
}
void solve() {
ll n, m; scanf("%lld%lld", &n, &m);
ll ans=;
for (ll i=; i*i<=n; i++) {
if (n%i==) {
if (i>=m) ans+=euler(n/i);
if (n/i>=m&&i*i!=n) ans+=euler(i);
}
}
cout<<ans<<endl;
}
int main() {
int t = ;
// freopen("in.txt", "r", stdin);
//freopen("out.txt", "w", stdout);
scanf("%d", &t);
while(t--)
solve();
return ;
}

hdu 2588(简单的欧拉的更多相关文章

  1. 题解报告:hdu 2588 GCD(欧拉函数)

    Description The greatest common divisor GCD(a,b) of two positive integers a and b,sometimes written ...

  2. HDU 2588 GCD(欧拉函数)

    GCD Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submis ...

  3. hdu GuGuFishtion 6390 数论 欧拉函数

    题目:http://acm.hdu.edu.cn/showproblem.php?pid=6390 直接开始证明: 我们设…………………………………….....…...............………… ...

  4. HDU 1695 GCD (欧拉函数+容斥原理)

    GCD Time Limit: 6000/3000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submiss ...

  5. HDU 5430 Reflect(欧拉函数)

    题目: http://acm.hdu.edu.cn/showproblem.php?pid=5430 从镜面材质的圆上一点发出一道光线反射NNN次后首次回到起点. 问本质不同的发射的方案数. 输入描述 ...

  6. hdu 5279 Reflect phi 欧拉函数

    Reflect Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://bestcoder.hdu.edu.cn/contests/contest_chi ...

  7. HDU 1695 GCD(欧拉函数+容斥原理)

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1695 题意:x位于区间[a, b],y位于区间[c, d],求满足GCD(x, y) = k的(x, ...

  8. hdu 1695 GCD (欧拉函数、容斥原理)

    GCD Time Limit: 6000/3000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submis ...

  9. HDU 1787 GCD Again(欧拉函数,水题)

    GCD Again Time Limit: 1000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total S ...

随机推荐

  1. sqoop2问题解决

    sqoop:000> show version --serverException has occurred during processing command Exception: org.a ...

  2. numpy的使用数组的创建2

    随机创建了长度为十的数组 获得十以类的随机整数 快速获取数组2乘3维的数组 生成20个1到10之间的数组 通过reshape 将这些数变成二位数组 shape这个方法可以查看数组中的元素是几行几列的

  3. oracle 修改数据精度问题

    今天,在建表后插入语句时,报了这样的错误,对于这样的错误,搜集了一些资料,进行了总结如下: 建表语句: 1 2 3 4 5 6 7 8 9 create table pre_info( pre_cod ...

  4. glove

    glove - 必应词典 美[ɡlʌv]英[ɡlʌv] v.给戴手套:作…的手套 n.(分手指的)手套 网络分指手套:拳套:棒球之爱 变形复数:gloves:现在分词:gloving:过去分词:glo ...

  5. bbs项目富文本编辑器实现上传文件到media目录

    media目录是在project的settings中设置的,static目录是django自己使用的静态文件的上传目录,media目录是用户自定义上传文件的目录 # Django用户上传的文件都放在m ...

  6. jstl的forEach详解(转)

    <c:forEach>标签用于通用数据循环,它有以下属性 属 性 描 述 是否必须 缺省值 items 进行循环的项目 否 无 begin 开始条件 否 0 end 结束条件 否 集合中的 ...

  7. Android View 深度分析requestLayout、invalidate与postInvalidate

    前言 前几篇文章中,笔者对View的三大工作流程进行了详细分析,而这篇文章则详细讲述与三大工作流程密切相关的两个方法,分别是requestLayout和invalidate,如果对Viwe的三个工作流 ...

  8. centos7下的glusterfs的安装与使用

    环境说明: 两台虚拟主机,IP分别为192.168.1.222和192.168.1.233,分别装上glusterfs. 一.下载glusterfs源码包 https://download.glust ...

  9. [z]cxf生成javaclient

    \apache-cxf-3.1.6\bin>wsdl2java -client http://192.168.129.224:8000/PricingEngine?wsdl

  10. Win7 64位VC6调试无法退出

    错误信息:LINK: fatal error LNK1168: cannot open Debug/test1.exe for writing 根据网络上查询,找到最终原因,DM.dll,TLLOC. ...