博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
poj 2389 大整数乘法
阅读量:6902 次
发布时间:2019-06-27

本文共 649 字,大约阅读时间需要 2 分钟。

 

#include
#include
#include
using namespace std;int main(){ char str1[1000],str2[1000]; cin>>str1>>str2; int sum[1000]; memset(sum,0,sizeof(sum)); int len1 = strlen(str1),len2 = strlen(str2); for(int i = len1-1;i>=0;i--) for(int j = len2-1;j>=0;j--) sum[1000-(len1+len2-2-i-j)-1] += (str1[i]-'0')*(str2[j]-'0'); for(int i = 1000-1;i>=0;i--) { if(sum[i]>9) sum[i-1] += sum[i]/10; sum[i] %= 10; } int i = 0; while(sum[i]==0) i++; for(;i<1000;i++) cout<

 

转载于:https://www.cnblogs.com/ZZUGPY/p/8476177.html

你可能感兴趣的文章
Map和Stack的STL方法简介
查看>>
Tasks Queues and Cron Jobs(任务队列和时钟守护作业)
查看>>
BZOJ1070[SCOI2007]修车——最小费用最大流
查看>>
elasticsearch映射 mapping
查看>>
UIView常用的一些方法小记之setNeedsDisplay和setNeedsLayout
查看>>
make常见报错原因分析
查看>>
gitlab的安装和配置
查看>>
[转载] OpenCV2.4.3 CheatSheet学习(二)
查看>>
Code::Blocks(完全取代VC6的开源跨平台编程利器)
查看>>
“异或”运算符
查看>>
OpenJudge/Poj 1004 Financial Management
查看>>
模拟 --- 简单括号匹配
查看>>
面向服务(接口)开发过程中常用的实体类数据复制解决方案
查看>>
easyui树动态加载参考
查看>>
Scala 学习笔记之函数(3)
查看>>
从零开始--系统深入学习android(实践-让我们开始写代码-Android框架学习-2. 输入控件)...
查看>>
Fiddler (二) Script 用法
查看>>
Object To Enum
查看>>
hadoop2.5.2学习及实践笔记(六)—— Hadoop文件系统及其java接口
查看>>
Valid Number leetcode
查看>>