
数论
SandraOvO
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
欧几里德与扩展欧几里德算法
欧几里德算法(辗转相除法) 可用于计算两个整数a,b的公约数和公倍数定理:gcd(a, b) = gcd(b , a%b)int gcd(int a,int b){ return b ? gcd(b,a%b):a;}最小公倍数是: a*b/gcd(a,b) 不过我们为了防止a*b的溢出 采取先除后乘a/gcd(a,b)*b扩展欧几里德算法基本算法:对于不完原创 2016-06-27 21:58:21 · 246 阅读 · 0 评论 -
A/B(乘法逆元)
A/BDescription要求(A/B)%9973,但由于A很大,我们只给出n(n=A%9973)(我们给定的A必能被B整除,且gcd(B,9973) = 1)。 Input数据的第一行是一个T,表示有T组数据。 每组数据有两个数n(0 Output对应每组数据输出(A/B)%9973。原创 2016-06-27 22:25:08 · 496 阅读 · 0 评论 -
POJ 2262 Goldbach's Conjecture(素数)
DescriptionIn 1742, Christian Goldbach, a German amateur mathematician, sent a letter to Leonhard Euler in which he made the following conjecture: Every even number greater than 4 can be wri原创 2016-06-27 22:28:51 · 334 阅读 · 0 评论 -
HDU 1222 Wolf and Rabbit(gcd)
DescriptionThere is a hill with n holes around. The holes are signed from 0 to n-1. A rabbit must hide in one of the holes. A wolf searches the rabbit in anticlockwise order. The first h原创 2016-06-27 22:30:28 · 421 阅读 · 0 评论 -
COJ 1010 [001]质因数分解 [EASY]
[001]质因数分解 [EASY]Time Limit: 1000 ms Memory Limit: 65536 KBTotal Submit: 1891 Accepted: 582 Description找出输入整数的所有质因数(包括重复质因数),并按从小到大的顺序依次输出。Input输入一组待分解整数,每个整数k占一行。原创 2016-06-24 10:09:43 · 1077 阅读 · 0 评论