随笔分类 -  数学--高精度

大数加法和乘法(用long long数据类型无法计算和储存的数)
摘要:对于超过20位的数的乘法问题,我们无法使用普通的方法!!!即使是longlong也会超出范围的!像这样的数,我们只能使用高精度的知识利用数组的方法解决问题!对于高精度乘法的问题,其实思路和高精度加法的思路差不多,都需要使用字符数组来存放每次算完的结果! 1 2 3 *4 5 6 __________... 阅读全文
posted @ 2015-12-29 20:53 茶飘香~ 阅读(303) 评论(0) 推荐(0)
摘要:DescriptionThink about a plane:● One straight line can divide a plane into two regions.● Two lines can divide a plane into at most four regions.● Thre... 阅读全文
posted @ 2015-10-10 12:19 茶飘香~ 阅读(138) 评论(0) 推荐(0)
摘要:Description我们定义斐波那契数列如下:f1=1f2=2f(n)=f(n-1)+f(n-2)(n>=3)现在,给定两个数a和b,计算有多少个斐波那契数列中的数在a和b之间(包含边界)。Input输入包含多组测试数据,每组测试数据都是两个非负整数a和b,当a和b都等于0时,程序结束。0#inc... 阅读全文
posted @ 2015-08-16 18:19 茶飘香~ 阅读(466) 评论(0) 推荐(0)
摘要:A Fibonacci sequence is calculated by adding the previous two members the sequence, with the first two members being both 1.F(1) = 1, F(2) = 1, F(3) =... 阅读全文
posted @ 2015-08-16 18:05 茶飘香~ 阅读(346) 评论(0) 推荐(0)
摘要:1、stringadd(strings1,strings2){if(s1.length()=0;i--,j--){s1[i]=char(s1[i]+(j>=0?s2[j]-'0':0));if(s1[i]-'0'>=10){s1[i]=char((s1[i]-'0')%10+'0');if(i)s1... 阅读全文
posted @ 2015-08-14 20:48 茶飘香~ 阅读(191) 评论(0) 推荐(0)