高精度算法加法
来源:互联网 发布:select to SQL 编辑:程序博客网 时间:2024/06/08 07:23
高精度加法
#include<stdio.h>#include<string.h>int a[500],b[500],c[501],lena,lenb,lenc,i,j,x,k;void add(char *a1,char *b1){ memset(a,0,sizeof(a)); memset(b,0,sizeof(b)); memset(c,0,sizeof(c)); lena=strlen(a1); lenb=strlen(b1); for(i=0;i<lena;i++){ a[lena-i]=a1[i]-48; } for(i=0;i<lenb;i++){ b[lenb-i]=b1[i]-48; } lenc=1; x=0; while(lenc<=lena||lenc<=lenb){ c[lenc]=a[lenc]+b[lenc]+x; x=c[lenc]/10; c[lenc]%=10; lenc++; } c[lenc]=x; if(c[lenc]==0) lenc--; for(i=lenc;i>=1;i--){ printf("%d",c[i]); } printf("\n");}int main(){ char a1[500],b1[500],t; scanf("%s%d",a1,&t); add(a1,b1);}
1 0
- 高精度算法(加法)
- 高精度数算法 - - 加法
- 高精度算法之加法
- 算法提高 高精度加法
- 算法提高 高精度加法
- 高精度算法加法
- C++高精度算法之高精度加法
- 蓝桥杯 算法提高 高精度加法
- C++的高精度整数加法运算算法
- 高精度算法一:加法和减法
- 高精度加法——一步一步算法篇
- 算法提高 ADV-121 高精度加法
- 蓝桥杯训练:算法提高 高精度加法
- 高精度加法
- 高精度加法
- 高精度加法
- 高精度加法
- 高精度 加法
- Linux内核分析(一):计算机工作原理
- 不敢死队问题
- RecycleView的UP和Down加载
- redis使用教程(安装和连接)
- Codeforces Round #401 (Div. 2) D. Cloud of Hashtags
- 高精度算法加法
- sys/time.h 是GCC的编译标准写法
- hdu2521 反素数(求约数个数)
- android studio 中 java.lang.NoClassDefFoundError:retrofit2.Retrofit$Builder错误解决
- warning: Error opening file (../../modules/highgui/src/cap_ffmpeg_impl.hpp:545)
- TensorFlow数据处理方法
- EasyRTMP内置IPCamera实现RTMP直播摄像机功能
- 索引并发(蟹行协议和B-Link树)
- 练习