随笔分类 -  数学构造

maths
[数论]卡特兰数
摘要:火车进出站问题是一个经典 的卡特兰数问题可以使用组合公式求解f[N]=C(2n,n)/(n+1); 阅读全文
posted @ 2010-11-15 10:18 I WILL BE BETTER. 阅读(224) 评论(0) 推荐(0)
[数论]阶乘统计
摘要:n的阶乘定义为n!=1*2*3*……*n 如3!=6n!通常最后会有很多0,如5!=120 最后有一个0,现在统计n!去除末尾的0后,最后k位是多少 使用高精度乘以单精度,但只保留20位就可以了。还要去掉末尾的0. 阅读全文
posted @ 2010-11-15 09:07 I WILL BE BETTER. 阅读(718) 评论(0) 推荐(1)
[数论]有理逼近
摘要:描述对于一个素数P,我们可以用一系列有理分数(分子、分母都是不大于N的自然数)来逼近sqrt(p),例如P=2,N=5的时候:1/1<5/4<4/3<sqrt(2)<3/2<5/3<2/1。任 务 :给定P、N(N>sqrt(p)),求X、Y、U、V,使x/y<sqrt(p)<u/v且x/y与sqrt(p)之间、sqrt(p)与u/v之间都不能... 阅读全文
posted @ 2010-11-15 07:51 I WILL BE BETTER. 阅读(1110) 评论(0) 推荐(0)
【poj1006】Biorhythms
摘要:DescriptionSome people believe that there are three cycles in a person's life that start the day he or she is born. These three cycles are the physical, emotional, and intellectual cycles, and they ha... 阅读全文
posted @ 2010-10-29 17:48 I WILL BE BETTER. 阅读(836) 评论(0) 推荐(0)
【poj1005】I Think I Need a Houseboat
摘要:DescriptionFred Mapper is considering purchasing some land in Louisiana to build his house on. In the process of investigating the land, he learned that the state of Louisiana is actually shrinking by... 阅读全文
posted @ 2010-10-29 17:47 I WILL BE BETTER. 阅读(342) 评论(0) 推荐(0)
【poj1003】Hangover
摘要:DescriptionHow far can you make a stack of cards overhang a table? If you have one card, you can create a maximum overhang of half a card length. (We're assuming that the cards must be perpendicular t... 阅读全文
posted @ 2010-10-29 17:44 I WILL BE BETTER. 阅读(203) 评论(0) 推荐(0)
【poj1001】求高精度幂
摘要:Description对数值很大、精度很高的数进行高精度计算是一类十分常见的问题。比如,对国债进行计算就是属于这类问题。现在要你解决的问题是:对一个实数R( 0.0 < R < 99.999 ),要求写程序精确计算 R 的 n 次方(Rn),其中n 是整数并且 0 < n <= 25。InputT输入包括多组 R 和 n。 R 的值占第 1 到第 6 列,n 的值占第 8 ... 阅读全文
posted @ 2010-10-22 17:36 I WILL BE BETTER. 阅读(313) 评论(0) 推荐(0)
【noip2002】均分纸牌
摘要:[问题描述]  有 N 堆纸牌,编号分别为 1,2,…, N。每堆上有若干张,但纸牌总数必为 N 的倍数。可以在任一堆上取若于张纸牌,然后移动。  移牌规则为:在编号为 1 堆上取的纸牌,只能移到编号为 2 的堆上;在编号为 N 的堆上取的纸牌,只能移到编号为 N-1 的堆上;其他堆上取的纸牌,可以移到相邻左边或右边的堆上。  现在要求找出一种移动方法,用最少的移动次数使每堆上纸牌数... 阅读全文
posted @ 2010-10-15 16:35 I WILL BE BETTER. 阅读(199) 评论(0) 推荐(0)
汉诺塔
摘要:代码【问题描述】有若干个圆饼套在一根柱子里,形成了一个汉诺塔(圆饼从上到下依次编号为1~p),我们想把汉诺塔从0号柱子移到n+1号柱子,中间有n个柱子和m块空地给我们使用。移动规则如下:1. 从0号柱子移出的圆饼不能移回0号柱子,移到n+1号柱子的圆饼不能再移动。2. I号圆饼只能放在I+1号圆饼上、空地上和柱子最下面。3. 空地上只能放一个圆饼,而柱子上可以按规则2形成汉诺塔。4. 可以直接将圆... 阅读全文
posted @ 2010-10-13 17:47 I WILL BE BETTER. 阅读(301) 评论(0) 推荐(0)