
数论
冬天的一缕阳光
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
扩展GCD的运用
题目连接:http://acm.jlu.edu.cn/joj/upload/jlp2011.pdfProblem B: Xiao Ming’s Computer Xiao Ming is a clever boy who invented a strange computer named "Xiao Ming Computer". The computer has only原创 2013-07-14 19:26:19 · 870 阅读 · 0 评论 -
快速判断素数
快速判断一个数是否为素数:代码:typedef long long LL;LL exp_mod(LL a,LL b,LL m){ bool bit[64]; int i=0; while(b) { bit[i++] = b&1 ? 1 : 0; b >>= 1; } LL s=1; for原创 2013-08-16 17:06:49 · 847 阅读 · 0 评论 -
poj2954 Triangle
DescriptionA lattice point is an ordered pair (x, y) where x and y are both integers. Given the coordinates of the vertices of a triangle (which happen to be lattice points), you are to count the原创 2013-08-27 19:51:36 · 702 阅读 · 0 评论 -
poj2480 Longge's problem
DescriptionLongge is good at mathematics and he likes to think about hard mathematical problems which will be solved by some graceful algorithms. Now a problem comes: Given an integer N(1 "Oh,原创 2013-08-12 16:34:15 · 922 阅读 · 0 评论 -
反正切函数的应用
Description反正切函数可展开成无穷级数,有如下公式 (其中0 使用反正切函数计算PI是一种常用的方法。例如,最简单的计算PI的方法: PI=4arctan(1)=4(1-1/3+1/5-1/7+1/9-1/11+...) 公式(2) 然而,这种方法的效率很低,但我们可以根据角度和的正切函数公式: tan(a+b)=[tan(a)+tan(b原创 2013-08-12 11:55:23 · 1566 阅读 · 0 评论 -
poj 1423
DescriptionIn many applications very large integers numbers are required. Some of these applications are using keys for secure transmission of data, encryption, etc. In this problem you are given原创 2013-08-22 22:44:48 · 646 阅读 · 0 评论 -
Defending Castle poj2668
DescriptionThe kingdom Eintagra is in great danger! Overwhelming enemy has surrounded the emperor's castle and once they enter, a massacre is just what is going to be. Now what all people in t原创 2013-08-21 16:01:40 · 710 阅读 · 0 评论 -
欧拉函数
欧拉函数在编程中是非常重要的一个版块:φ函数的值 通式:φ(x)=x(1-1/p1)(1-1/p2)(1-1/p3)(1-1/p4)…..(1-1/pn),其中p1, p2……pn为x的所有质因数,x是不为0的整数。φ(1)=1(唯一和1互质的数就是1本身)。 (注意:每种质因数只一个。比如12=2*2*3 欧拉公式那么φ(12)=12*(1-1/2)*原创 2013-08-18 20:29:22 · 702 阅读 · 0 评论 -
Fiborial
DescriptionConsider a sequence Fi that satisfies the following conditions:Find the number of different divisors of Fn.InputInput file contains the only integer number原创 2013-07-27 13:56:25 · 824 阅读 · 0 评论 -
Partition
DescriptionDefine f(n) as the number of ways to perform n in format of the sum of some positive integers. For instance, when n=4, we have 4=1+1+1+1 4=1+1+2 4=1+2+1 4=2+1+1 4=1+原创 2013-07-24 21:13:26 · 737 阅读 · 0 评论 -
The Rascal Triangle
DescriptionThe Rascal Triangle definition is similar to that of the Pascal Triangle. The rows are numbered from the top starting with 0. Each rown contains n + 1 numbers indexed from 0 to n.原创 2013-07-24 21:48:10 · 834 阅读 · 0 评论 -
Set Division
DescriptionRuslan has K friends. And all of them have birthday tomorrow. He has bought N different photo albums yesterday, and wants to present these photo albums to his friends. Of course, he原创 2013-07-21 21:13:32 · 739 阅读 · 0 评论 -
poj 3372 Candy Distribution
DescriptionN children standing in circle who are numbered 1 through N clockwise are waiting their candies. Their teacher distributes the candies by in the following way:First the teacher gives c原创 2013-07-18 15:50:58 · 717 阅读 · 0 评论 -
poj2689 Prime Distance
DescriptionThe branch of mathematics called number theory is about properties of numbers. One of the areas that has captured the interest of number theoreticians for thousands of years is the qu原创 2013-08-16 09:57:52 · 721 阅读 · 0 评论