题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1695 题目解析: 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. 题目又说a==c==1,所以就是求[1,b]与[1,d]中gcd等于k的个数,因为若gcd(x,y)==z,那么gcd(x/z,y/z)==1,又因为不是z的倍数的肯定不是,所以不是z的倍数的可以直接去…
Relatives Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 11372 Accepted: 5544 Description Given n, a positive integer, how many positive integers less than n are relatively prime to n? Two integers a and b are relatively prime if ther…
Harry Potter and the Hide Story Time Limit: 10000/5000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others) Total Submission(s): 2193 Accepted Submission(s): 530 Problem Description iSea is tired of writing the story of Harry Potter, so,…
C. Enlarge GCD time limit per test1 second memory limit per test256 megabytes inputstandard input outputstandard output Mr. F has n positive integers, a1,a2,-,an. He thinks the greatest common divisor of these integers is too small. So he wants to en…
LCM Cardinality Input: Standard Input Output: Standard Output Time Limit: 2 Seconds A pair of numbers has a unique LCM but a single number can be the LCM of more than one possible pairs. For example 12 is the LCM of (1, 12), (2, 12), (3,4) etc. For a…
WhereIsHeroFrom: Zty, what are you doing ? Zty: I want to calculate N!.. WhereIsHeroFrom: So easy! How big N is ? Zty: 1 <=N <=1000000000000000000000000000000000000000000000- WhereIsHeroFrom: Oh! You must be crazy! Are you Fa Shao? Zty: No. I haven'…
容斥原理 A Number Sequence 题意:给出n个数,b1,b2,b3……bn,构造n个数,a1,a2,……an(ai>1),使得a1*a2*a3……an=b1*b2……bn 分析:容易想到的是将bi分解质因数,然后记录每个质因数的个数.那么题目变成:对于(每个质因数个数为m个划分到n个不同的容器的方案数),注意ai>1,所以没有某个数没有质因数.记f(n)为n个数字可能有1的方案数,g(n)为n个数字一定没有1的方案数.则,得到听说这是二项式反演? #include <bit…