高精度加法
来源:互联网 发布:淘宝买psv怎么送游戏 编辑:程序博客网 时间:2024/05/17 01:08
转自:http://blog.csdn.net/cnyali/article/details/43447755
程序:
#include<stdio.h>#include<stdlib.h>#include<string.h>int a[1000],b[1000],c[1000];char s[1000];int main(){int i,j,k,m,n;int alen,blen,clen;gets(s);alen=strlen(s);for(i=alen-1;i>=0;i--)a[alen-i]=s[i]-'0';gets(s);blen=strlen(s);for(i=blen-1;i>=0;i--)b[blen-i]=s[i]-'0';clen=alen>blen?alen:blen;for(i=1;i<=clen;i++)c[i]=a[i]+b[i];for(i=1;i<clen;i++)if(c[i]>=10){c[i+1]++;c[i]-=10;}for(i=clen;i>=1;i--)printf("%d",c[i]);puts("");return 0;}
3 0
- 高精度加法
- 高精度加法
- 高精度加法
- 高精度加法
- 高精度 加法
- 高精度加法
- 高精度加法
- 高精度加法
- 高精度加法
- 高精度加法
- 高精度加法
- 高精度加法
- 高精度加法
- 高精度加法
- 高精度加法
- 高精度加法
- 高精度加法
- 高精度加法
- linux之链表和哈希表应用浅析一
- PHP-PDO笔记
- svn---pre-commit提交前备注不能为空
- android 减少findViewById 的使用
- 明明的随机数
- 高精度加法
- 十字链表 、邻接多重表 、边集数组
- OpenWrt(8)------ 声卡加载与音乐播放
- 正反向代理的原理与区别
- hdu 3579(中国剩余定理非互质)
- python判断字符串编码——使用chardet判断字符串编码的方法
- Java中的栈,堆,方法区和常量池
- hdu2188 java
- hash function/ hash table 背后的数学基础(二)