高精度乘法
来源:互联网 发布:破解免流软件 编辑:程序博客网 时间:2024/05/18 00:35
#include<iostream>#include<cstring>#include<cmath>#include<cstdio>#include<cstdlib>#include<algorithm>using namespace std;char a[105],b[105];int x[105],y[105],z[10000005],tmp;int main(){ while(scanf("%s%s",a+1,b+1)!=EOF) { int l1=strlen(a+1),l2=strlen(b+1),l3; for(int i=1;i<=l1;i++) x[i]=a[l1-i+1]-'0'; for(int i=1;i<=l2;i++) y[i]=b[l2-i+1]-'0'; memset(z,0,sizeof(z)); for(int i=1;i<=l1;i++) { tmp=0; for(int j=1;j<=l2;j++) { z[i+j-1]+=(x[i]*y[j]+tmp); tmp=z[i+j-1]/10; z[i+j-1]%=10; } z[i+l2]=tmp; } l3=l1+l2; while(z[l3]==0&&l3>=1) l3--; for(int i=l3;i>=1;i--) printf("%d",z[i]); printf("\n"); } return 0;}
0 0
- 高精度乘法
- 高精度乘法
- 高精度乘法
- 高精度乘法
- 高精度乘法
- 高精度乘法
- 高精度乘法
- 高精度乘法
- 高精度乘法
- 高精度乘法
- 高精度乘法
- 高精度乘法
- 高精度乘法
- 高精度乘法
- 高精度乘法
- 高精度乘法
- 高精度乘法
- 高精度乘法
- js获取url传递参数
- 为什么静态成员、静态方法中不能用this和super关键字
- NSURLSession与NSURLConnection区别
- 欢迎使用CSDN-markdown编辑器
- split分页中每页首条记录索引的计算方法
- 高精度乘法
- 阿里面试回来,想和Java程序员谈一谈
- 浅谈java继承中对于main方法的继承之奇葩问题
- 注册JNI函数的两种方式
- 计算机系统简介
- 天池新手平台赛ODPS入门代码
- Struts有什么优缺点
- C++编译的环境变量问题
- how to make jelly effect on belly in maya