摘要:
题目链接:传送门 题目需求: Given an integer N(1 < N < 2^31),you are to calculate ∑gcd(i, N) 1<=i <=N. 这题就是上一篇博客的变形。 题目解析:首先先求出与N互质的个数,即N的欧拉函数值,之后分解出N的因子来,求解方法如下。 阅读全文
摘要:
题目链接:传送门 题目需求:Given integers N and M, how many integer X satisfies 1<=X<=N and (X,N)>=M.(2<=N<=1000000000, 1<=M<=N), 题目解析: 求(X,N),不用想要分解N的因子,分解方法如下,我一 阅读全文
摘要:
题目链接:http://poj.org/problem?id=2992 题目要求:Your task in this problem is to determine the number of divisors of Cnk. Just for fun -- or do you need any s 阅读全文
摘要:
题目链接: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 + b) % p = (a % p + b % p) % p (1) (a - b) % p = (a % p - b % p) % p (2) (a * b) % p = (a % p * b % p) % p 阅读全文