随笔分类 - 数学---莫比乌斯反演
摘要:Alex decided to try his luck in TV shows. He once went to the quiz named "What's That Word?!". After perfectly answering the questions "How is a pseud
阅读全文
摘要:Sample Input Sample Output You are given a {1, 2, ..., n}-permutation a[1], a[2], ..., a[n]. How many pairs of integers (i, j) satisfy 1 ≤ i ≤ j ≤ n a
阅读全文
摘要:In an attempt to make peace with the Mischievious Mess Makers, Bessie and Farmer John are planning to plant some flower gardens to complement the lush
阅读全文
摘要:4833: [Lydsy1704月赛]最小公倍佩尔数 Description 令(1+sqrt(2))^n=e(n)+f(n)*sqrt(2),其中e(n),f(n)都是整数,显然有(1-sqrt(2))^n=e(n)-f(n)*sqrt(2)。令g( n)表示f(1),f(2)…f(n)的最小公倍
阅读全文
摘要:Description 设d(x)为x的约数个数,给定N、M,求 设d(x)为x的约数个数,给定N、M,求 Input 输入文件包含多组测试数据。 第一行,一个整数T,表示测试数据的组数。 接下来的T行,每行两个整数N、M。 输入文件包含多组测试数据。 第一行,一个整数T,表示测试数据的组数。 接下
阅读全文
摘要:题意:略。 思路:问题转化为1到N,他们的满足mu[d]!=0的因子d个数。 即1到N的因子的莫比乌斯系数平方和。 (经验:累加符号是累加的个数,我们把常数提到前面,然后用杜教筛累加个数即可。 https://www.cnblogs.com/clrs97/p/6012285.html 关键部分,pe
阅读全文
摘要:Given you a sequence of number a 1, a 2, ..., a n, which is a permutation of 1...n. You need to answer some queries, each with the following format: G
阅读全文
摘要:Tiny Wong the chef used to be a mathematics teacher in a senior high school. At that time, he always used to tell his students that when there is a sq
阅读全文
摘要:Let's call a non-empty sequence of positive integers a1, a2... ak coprime if the greatest common divisor of all elements of this sequence is equal to
阅读全文
摘要:Count the number of distinct sequences a1, a2, ..., an (1 ≤ ai) consisting of positive integers such that gcd(a1, a2, ..., an) = x and . As this numbe
阅读全文
摘要:有n个数字,a11,a22,…,ann。有一个集合,刚开始集合为空。然后有一种操作每次向集合中加入一个数字或者删除一个数字。每次操作给出一个下标x(1 ≤ x ≤ n),如果axx已经在集合中,那么就删除axx,否则就加入axx。 问每次操作之后集合中互质的数字有多少对。 注意,集合中可以有重复的数
阅读全文
摘要:在【乔明达的省选专题】里面有很多这样的解题技巧: 把Σ*Σ类型的题O(n^2)转化∑[n/i]∑[m/i],除法下结果相同的部分合并,复杂度降低至O(√n+√m)。当然论文里的题型应该说说很经典了。这里再积累几个基础题型。 1,求前n个正整数的约数之和,即∑=σ(i) ,(i=1到n)。其中n≤10
阅读全文
摘要:Miller-Rabin Pollard-rho (输入一个数n,输出小于n且与n互素的整数个数) (大数欧拉,启发式分解) 拓展gcd 逆元 错排 排列组合 C(n,m) 先init 再comb(n,m) n在下 C(n,m) 不mod C(n,m) mod p (p为素数) C(n,m) mod
阅读全文