上一页 1 2 3 4 5 6 7 ··· 18 下一页

2017年8月17日

hdu4675 GCD of Sequence 莫比乌斯+组合数学

摘要: /** 题目:hdu4675 GCD of Sequence 链接:http://acm.hdu.edu.cn/showproblem.php?pid=4675 题意:给定n个数的a数组,以及m,k; 构造满足1k那么无解)个数必须变成d的倍数,有(M/d)^(n-cnt)种情况; 还剩下k-(n-cnt)个数需要从a数组cnt个是d的倍数中改变。有C(cnt,k-(n-cnt))*(M/d-... 阅读全文

posted @ 2017-08-17 09:03 hnust_accqx 阅读(155) 评论(0) 推荐(0) 编辑

2017年8月16日

hdu4746 Mophues 莫比乌斯

摘要: /** 题目:hdu4746 Mophues 链接:http://acm.hdu.edu.cn/showproblem.php?pid=4746 题意:求x,y在给定范围内gcd(x,y)分解素因子的个数 #include #include #include #include #include #include using namespace std; typedef long lo... 阅读全文

posted @ 2017-08-16 20:26 hnust_accqx 阅读(192) 评论(0) 推荐(0) 编辑

BZOJ2820 YY的GCD 莫比乌斯+系数前缀和

摘要: /** 题目:BZOJ2820 YY的GCD 链接:http://www.cogs.pro/cogs/problem/problem.php?pid=2165 题意:神犇YY虐完数论后给傻×kAc出了一题 给定N, M,求1 #include #include #include #include #include #include using namespace std; typed... 阅读全文

posted @ 2017-08-16 11:23 hnust_accqx 阅读(159) 评论(0) 推荐(0) 编辑

2017年8月15日

bzoj2005 能量采集 莫比乌斯或者普通容斥

摘要: /** 题目:bzoj2005 能量采集 链接:https://vjudge.net/contest/178455#problem/F 题意:栋栋有一块长方形的地,他在地上种了一种能量植物,这种植物可以采集太阳光的能量。在这些植物采集能量后, 栋栋再使用一个能量汇集机器把这些植物采集到的能量汇集到一起。 栋栋的植物种得非常整齐,一共有n列,每列 有m棵,植物的横竖间距都一样,因此对于每一棵植物... 阅读全文

posted @ 2017-08-15 10:19 hnust_accqx 阅读(143) 评论(0) 推荐(0) 编辑

GCD 莫比乌斯反演 给定整数N,求1<=x,y<=N且Gcd(x,y)为素数的 数对(x,y)有多少对.

摘要: /** 题目:GCD 链接:https://vjudge.net/contest/178455#problem/E 题意:给定整数N,求1 #include #include #include #include #include #include using namespace std; typedef long long LL; #define ms(x,y) memset(x,y... 阅读全文

posted @ 2017-08-15 09:13 hnust_accqx 阅读(810) 评论(0) 推荐(0) 编辑

2017年8月14日

spoj7001 Visible Lattice Points 莫比乌斯反演+三维空间互质对数

摘要: /** 题目:Visible Lattice Points 链接:https://vjudge.net/contest/178455#problem/A 题意:一个n*n*n大小的三维空间。一侧为(0,0,0)另一侧为(n,n,n); 问从(0,0,0)出发的经过该范围三维空间内整数点坐标的射线有多少条。 思路: 类比二维的:求1 #include #include #include #... 阅读全文

posted @ 2017-08-14 22:49 hnust_accqx 阅读(159) 评论(0) 推荐(0) 编辑

hdu1695 GCD 莫比乌斯反演做法+枚举除法的取值 (5,7),(7,5)看做同一对

摘要: /** 题目:hdu1695 GCD 链接:http://acm.hdu.edu.cn/status.php 题意:对于给出的 n 个询问,每次求有多少个数对 (x,y) , 满足 a ≤ x ≤ b , c ≤ y ≤ d ,且 gcd(x,y) = k ,(5,7),(7,5)看做同一对, gcd(x,y) 函数为 x 和 y 的最大公约数。 本题默认:a = c = 1; 0 #inc... 阅读全文

posted @ 2017-08-14 21:45 hnust_accqx 阅读(136) 评论(0) 推荐(0) 编辑

bzoj2440 完全平方数 莫比乌斯值+容斥+二分

摘要: 莫比乌斯值+容斥+二分 /** 题目:bzoj2440 完全平方数 链接:http://www.lydsy.com/JudgeOnline/problem.php?id=2440 题意:求第k个小x数。小x数是指不存在某个素因子次数>=2。1也是小x数。 思路:二分x,求[1,x]有多少个小x数。如果一个数是某个素数的平方的倍数,那么不是小x数。 所以要减去。2^2的倍数, 3^2的倍数, ... 阅读全文

posted @ 2017-08-14 20:58 hnust_accqx 阅读(140) 评论(0) 推荐(0) 编辑

Problem b 莫比乌斯反演+枚举除法的取值

摘要: 莫比乌斯反演+枚举除法的取值 第二种形式: f(n)表示gcd(x,y)=n的数量。 F(n)表示gcd(x,y)是n的倍数的数量。 /** 题目:Problem b 链接:https://vjudge.net/contest/178455#problem/G 题意:对于给出的 n 个询问,每次求有多少个数对 (x,y) , 满足 a ≤ x ≤ b , c ≤ y ≤ d ,且 gcd(x,y... 阅读全文

posted @ 2017-08-14 20:58 hnust_accqx 阅读(129) 评论(0) 推荐(0) 编辑

Codeforces839D Winter is here 容斥

摘要: /** 题目:Codeforces839D Winter is here 链接:http://codeforces.com/contest/839/problem/D 题意:给定n个数,求所有的最大公约数>1的子集的贡献之和。 一个子集的贡献为最大公约数*子集大小 思路: cnt[i]表示约数为i的数的个数。 ans[i]表示约数为i的所有k的和。 已知ans[i]可以求得贡献为i*ans[i... 阅读全文

posted @ 2017-08-14 11:41 hnust_accqx 阅读(103) 评论(0) 推荐(0) 编辑

上一页 1 2 3 4 5 6 7 ··· 18 下一页

导航