数论
文章平均质量分 77
amateur
这个作者很懒,什么都没留下…
展开
-
poj 2478 Farey Sequence (欧拉函数)
Description The Farey Sequence Fn for any integer n with n >= 2 is the set of irreducible rational numbers a/b with 0 F2 = {1/2} F3 = {1/3, 1/2, 2/3} F4 = {1/4, 1/3, 1/2, 2/3, 3/4} F5 = {1/5,原创 2012-08-23 14:31:45 · 1061 阅读 · 0 评论 -
poj 3090 Visible Lattice Points
Description A lattice point (x, y) in the first quadrant (x andy are integers greater than or equal to 0), other than the origin, is visible from the origin if the line from (0, 0) to (x,y) does原创 2012-08-23 15:23:16 · 553 阅读 · 0 评论 -
基于扩展欧几里得的证明的个人理解
扩展欧几里德算法是用来在已知a, b求解一组整数解(x,y)使得ax+by=gcd(a,b),这个方程一定有解,记d=gcd(a,b),a=d*a',b=d*b',那么必须有d/b,否则方程变为a'x+b'y=b/d,左边是整数,右边却不是,这样就无解了。 C++实现: int gcd(int a, int b, int &x, int &y) { i原创 2012-08-23 16:22:58 · 743 阅读 · 0 评论 -
poj 2142 The Balance (基础扩展欧几里得)
Description Ms. Iyo Kiffa-Australis has a balance and only two kinds of weights to measure a dose of medicine. For example, to measure 200mg of aspirin using 300mg weights and 700mg weights, she can原创 2012-08-24 14:07:37 · 607 阅读 · 0 评论