poj 2389 高精度乘法基本问题
来源:互联网 发布:SWAMM软件 编辑:程序博客网 时间:2024/06/05 14:42
#include<iostream>#include<cstring>using namespace std;int main(){char a[1000],b[1000];int a1[1000]={0},b1[1000]={0},c[1000]={0};int i,j,len,len1,len2,l;scanf("%s %s",a,b);len1=strlen(a);len2=strlen(b);l=len1>len2?len1:len2;for(i=0;i<len1;i++)a1[i]=a[len1-1-i]-'0';for(i=0;i<len2;i++)b1[i]=b[len2-1-i]-'0';for(i=0;i<len1;i++)for(j=0;j<len2;j++)c[i+j]+=a1[i]*b1[j];len=len1+len2;for(i=0;i<len-1;i++){c[i+1]+=c[i]/10;c[i]=c[i]%10;}if(c[len-1]==0&&c[len-2]==0)cout<<"0"<<endl;else{if(c[len-1]>0)len++; for(i=len-2;i>=0;i--) cout<<c[i]; cout<<endl;}}
高精度乘法基本问题,最简单的形式。
0 0
- poj 2389 高精度乘法基本问题
- poj 2389 Bull Math 高精度乘法模板
- poj 1001 高精度乘法
- POJ 1001 高精度乘法
- 高精度正整数乘法问题
- POJ 1001 高精度乘法运算
- POJ 3289(高精度乘法)
- poj 1001 (Exponentiation) 高精度乘法
- POJ 1306 Combinations 高精度乘法
- 【POJ】 1001-Exponentiation 【高精度乘法】
- POJ 1001 Exponentiation 高精度乘法
- poj 1001 Exponentiation 高精度乘法
- POJ 1001(高精度乘法)
- POJ 2389 Bull Math 高精度(大数)乘法 模板
- poj 1001 Exponentiation(高精度乘法)
- POJ 2390 (小数高精度乘法)
- POJ 1001 Exponentiation (高精度/大数乘法)
- POJ 1001 高精度乘法加小数点处理
- 暑假第8天 7月13日
- 选择Session还是Cookie
- iOS7时代我们用什么来追踪和识别用户?udid?OpenUDID ?UUIDString
- git的一些操作
- [HDOJ] problem_1166 【敌兵布阵】 第一道线段树 纪念一下
- poj 2389 高精度乘法基本问题
- android按钮被点击文字颜色变化效果
- Linux ALSA声卡驱动之五:移动设备中的ALSA(ASoC)
- 管式超滤系统:超滤系统中膜的分类
- Config使用模式
- ECshop核心代码
- CodeIgniter实现config控制的多语言,可根据浏览器语言自动转换
- 暑假第9天 7月14日
- 百度地图实现区域省市周边覆盖模糊化(简单实现)