码迷,mamicode.com
首页 >  
搜索关键字:大数相乘 大数相加    ( 234个结果
大数相加—位运算
本文整理了C语言中大数据的相加算法,基于位运算来实现。亲测可用。 //100位大数相加 #include #include #define Max 101//有进位101 int bigNumAdd(char a[],char b[],char sum[]) { int i=0; int c=0;//表示进位 //清0 ...
分类:其他好文   时间:2014-12-19 17:33:31    阅读次数:151
海豚实习-实现两个大数相乘
问题描述:定义大数d为一个数组,表示为:d=a[k-1]*10^(k-1)+a[k-2]*10^(k-2)+...+a[1]*10+a[0](k为数组长度),实现一个函数,返回两个大数相乘的结果    /**      d1=a[k-1]*10^(k-1)+a[k-2]*10^(k-2)+...+a[1]*10+a[0]       d2=b[l-1]*10^(l-1)+b[l-2]*10^...
分类:其他好文   时间:2014-12-07 11:22:11    阅读次数:171
HDU 1002
大数相加,我的做法是开两个字符数组,和整型数组,将字符数组存到整型数组里面去,让两个整型数组相加,如果大于等于10,前一位进一(因为存的时候顺序已经反了)。。 然后从后面开始判断非0,如果遇到不是零的直接跳出,输出数组。直接上代码吧。 #include #include int main() { int a[1005]; int b[1005]; char a1[1...
分类:其他好文   时间:2014-12-05 17:34:17    阅读次数:228
题目1198:a+b(大数相加)
题目描述:实现一个加法器,使其能够输出a+b的值。输入:输入包括两个数a和b,其中a和b的位数不超过1000位。输出:可能有多组测试数据,对于每组数据,输出a+b的值。样例输入:2 610000000000000000000 10000000000000000000000000000000样例输出:...
分类:其他好文   时间:2014-12-04 22:51:31    阅读次数:205
Product(大数相乘)
Description The problem is to multiply two integers X, Y. (0 Input The input will consist of a set of pairs of lines. Each line in pair contains one multiplyer. Output For...
分类:其他好文   时间:2014-11-25 14:39:45    阅读次数:169
Integer Inquiry(大数相加)
Description One of the first users of BIT's new supercomputer was Chip Diller. He extended his exploration of powers of 3 to go from 0 to 333 and he explored taking various sums of those numbers....
分类:其他好文   时间:2014-11-25 14:39:38    阅读次数:275
UVa 10106 Product 【大数相乘】WA
虽然是错的代码,但是还是想贴出来,最开始WA发现是没有考虑到乘积为0的情况,后来把a*0,0*a,a*0---0(若干个0),0--0(若干个0)*a都考虑进去了;可是还是WA,实在不懂先留在这儿。ProductThe ProblemThe problem is to multiply two in...
分类:其他好文   时间:2014-11-24 07:35:51    阅读次数:127
UVa 424 Integer Inquiry 【大数相加】
解题思路:因为给定的数据是多组,所以我们只需要多次做加法就可以了,将上一次的和又作为下一次加法运算的一个加数。反思:还是题意理解不够清楚,最开始以为只是算三个大数相加,后来才发现是多个,然后注意到当输入a的第一个字符为0的时候结束运算,输出结果。Integer InquiryOne of the f...
分类:其他好文   时间:2014-11-24 07:35:30    阅读次数:191
[ACM] ZOJ Martian Addition (20进制的两个大数相加)
Martian Addition Time Limit: 2 Seconds      Memory Limit: 65536 KB   In the 22nd Century, scientists have discovered intelligent residents live on the Mars. Martians are very fond of mathematics...
分类:其他好文   时间:2014-11-19 20:39:08    阅读次数:205
杭电 1002 A + B Problem II【大数相加】
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1002解题思路:就是把大的数用数组存放起来,像小学的时候用竖式加法来算两个数相加那样算;反思:思路很简单,可是有很多细节考虑不好,有时候没有进位,有时候又没有输出正确的答案,然后有时候数组长度又开小了什么...
分类:其他好文   时间:2014-11-19 18:21:53    阅读次数:222
234条   上一页 1 ... 17 18 19 20 21 ... 24 下一页
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!