随笔分类 -  莫比乌斯函数

摘要:You are given an array AA , and Zhu wants to know there are how many different array BB satisfy the following conditions?1≤Bi≤Ai1≤Bi≤Ai For ea... 阅读全文
posted @ 2017-09-19 21:18 黑码的博客 阅读(143) 评论(0) 推荐(0)
摘要:给定整数N,求1using namespace std;const int maxn=1e7+10; bool vis[maxn]; int prime[maxn],mu[maxn]; int cnt; typedef long long ll;void Init(){ ... 阅读全文
posted @ 2017-09-19 21:18 黑码的博客 阅读(117) 评论(0) 推荐(0)
摘要:Given 5 integers: a, b, c, d, k, you’re to find x in a…b, y in c…d that GCD(x, y) = k. GCD(x, y) means the greatest common divisor of x and y.... 阅读全文
posted @ 2017-09-19 21:18 黑码的博客 阅读(135) 评论(0) 推荐(0)
摘要:Winter is here at the North and the White Walkers are close. John Snow has an army consisting of n soldiers. While the rest of the world is fi... 阅读全文
posted @ 2017-09-19 21:18 黑码的博客 阅读(290) 评论(0) 推荐(0)
摘要:题意:求正方体 n*n*n,固定其中一个点在(0,0,0) 问在正方体里又多少不同的直线。这个题的难点是如果排除掉重复的直线 例如 4,4,4 那么 2,2,2 和 4, 4,4 是相同的推荐两个博客:http://blog.csdn.net/lixuepeng_001/articl... 阅读全文
posted @ 2017-09-19 21:18 黑码的博客 阅读(156) 评论(0) 推荐(0)
摘要:HDU1695的题目大意是这样的,给你 a , b , c , d , k 五个值 (题目说明了 你可以认为 a=c=1) x 属于 [1,b] ,y属于[1,d] 让你求有多少对这样的 (x,y)满足gcd(x,y)==k。这一题和hdu 6053不一样的地方在于,在hdu60... 阅读全文
posted @ 2017-09-19 21:18 黑码的博客 阅读(118) 评论(0) 推荐(0)
摘要:lyk有两序列a和b。 lyk想知道存在多少对x,y,满足以下两个条件。 1:gcd(x,y)=1。 2: abxabx = baybay 。例如若a={1,1,1},b={1,1,1}。那么存在7对,因为除了x=2,y=2或x=3,y=3外都满足条件。 Input 第一行一个数... 阅读全文
posted @ 2017-09-19 21:17 黑码的博客 阅读(293) 评论(0) 推荐(0)
摘要:莫比乌斯函数,由德国数学家和天文学家莫比乌斯提出。梅滕斯(Mertens)首先使用μ(n)(miu(n))作为莫比乌斯函数的记号。具体定义如下: 如果一个数包含平方因子,那么miu(n) = 0。例如:miu(4), miu(12), miu(18) = 0。 如果一个数不包含平方因... 阅读全文
posted @ 2017-09-19 21:17 黑码的博客 阅读(157) 评论(0) 推荐(0)
摘要:https://loj.ac/problem/528不含平方因子的数才会有 -1 和 1才会对结果造成影响, 所有排除掉所有含有平方因子的数就好开始的时候平方是1 就是没有平方因子的情况,减去所有平方因子的情况#include using namespace std;const in... 阅读全文
posted @ 2017-09-19 21:17 黑码的博客 阅读(186) 评论(0) 推荐(0)