A*B Problem
分析
要用高精度,数组一定要开得大。我做的时候,就是因为数组不够大而和我朋友调试了超久。
const
maxn=2600;
var
a,b:array[1..maxn]of longint;
c:array[1..2*maxn]of longint;
l1,l2:longint;
procedure init;
var
s1,s2:ansistring;
i:longint;
begin
fillchar(a,sizeof(a),0);
fillchar(b,sizeof(b),0);
fillchar(c,sizeof(c),0);
readln(s1);
readln(s2);
l1:=length(s1);
l2:=length(s2);
for i:=l1 downto 1 do
a[l1-i+1]:=ord(s1[i])-ord('0');
for i:=l2 downto 1 do
b[l2-i+1]:=ord(s2[i])-ord('0');
end;
procedure main;
var
i,j:longint;
begin
for i:=1 to maxn do
begin
for j:=1 to maxn do
begin
c[i+j-1]:=a[i]*b[j]+c[i+j-1];
c[i+j]:=c[i+j]+c[i+j-1] div 10;
c[i+j-1]:=c[i+j-1] mod 10;
end;
end;
end;
procedure print;
var
i,j:longint;
begin
i:=maxn;
while (c[i]=0)and(i>1) do dec(i);
for j:=i downto 1 do
write(c[j]);
end;
begin
init;
main;
print;
end.
转载于:https://www.cnblogs.com/YYC-0304/p/9500216.html
A*B Problem相关推荐
- linux下yum错误:[Errno 14] problem making ssl connection Trying other mirror.
所有的base 都要取消注释 mirrorlist 加上注释 另外所有的enable都要设为零 目录 今天是要yum命令安装EPEL仓库后 yum install epel-release 突然发现y ...
- A + B Problem
1001: A + B Problem Description 计算 A + B. Input 多组测试数据,每组测试数据占一行,包括2个整数. Output 在一行中输出结果. Sample Inp ...
- Error:(49, 1) A problem occurred evaluating project ':guideview'. Could not read script 'https://r
出现问题如下: Error:(49, 1) A problem occurred evaluating project ':guideview'. > Could not read script ...
- #418 Div2 Problem B An express train to reveries (构造 || 全排列序列特性)
题目链接:http://codeforces.com/contest/814/problem/B 题意 : 有一个给出两个含有 n 个数的序列 a 和 b, 这两个序列和(1~n)的其中一个全排列序列 ...
- ADPRL - 近似动态规划和强化学习 - Note 3 - Stochastic Infinite Horizon Problem
Stochastic Infinite Horizon Problem 3.Stochastic Infinite Horizon Problem 定义3.1 无限范围的马尔可夫决策过程 (Marko ...
- ADPRL - 近似动态规划和强化学习 - Note 2 - Stochastic Finite Horizon Problem
2. Stochastic Finite Horizon Problem 在这一节中主要介绍了随机DP算法来解决不确定性下的有限地范围问题,如Denition 1.4所述,它被表述为一个组合优化问题. ...
- There was a problem confirming the ssl certificate ……
在安装一个Python库onetimepass时发生下面的问题: pip install onetimepass Could not fetch URL https://pypi.python.org ...
- HDU 1757 A Simple Math Problem
Problem Description Lele now is thinking about a simple function f(x). If x < 10 f(x) = x. If x & ...
- The C10K problem原文翻译
原文地址:http://www.cnblogs.com/fll/archive/2008/05/17/1201540.html The C10K problem 如今的web服务器需要同时处理一万个以 ...
- This is probably not a problem with npm. There is likely additional logging output above
微信小程序开发交流qq群 173683895 承接微信小程序开发.扫码加微信. E:\weii_objct\invoice-manage-web-view>npm start > ...
最新文章
- oracle 11gr2 单机数据库使用asm,RHEL7上安装11gR2单机使用ASM存储搭建Physical Standby笔记...
- python现在最新的版本-Python 3.8 已发布,现在是切换至新版本的好时机吗?
- python psycopg2_python2.7 psycopg2
- 若川知乎高赞:有哪些必看的 JS 库?
- iOS UISegmentedControl
- servlet是干什么的?
- Ajax传JSON对象报错:JSON parse error: Unrecognized token ‘ids‘: was expecting (‘true‘, ‘false‘ or ‘null‘);
- 对RAM,ROM,NOR/NAND FLASH等常见内存设备类型的理解
- excel函数应用:Column函数替代列参数提高公式灵活性
- 书籍折页是什么效果_问题:WPS里页面设置中的拼页,书籍折页,反向书籍折页分别是什么意思?打印出来的效果是什么样的? 要双面打印...
- 这5个优质动漫网站,能让你瞬间爆棚,都是满满的干货
- 【毕业设计】答 辩 技 巧 二(以一个过来人的身份,祝各位答辩 过 过 过)
- 【正向偏置和反向偏置的区别】
- 一分钟教你们证件照如何换背景颜色,快来收藏
- Windows10 笔记本电脑移动硬盘设备未就绪
- DBSCAN聚类算法简介
- Python:向ndarray中插入一个元素
- 《高校bbs或者科研论坛》
- Axure 9做原型只能显示为黑白灰色,设置彩色不生效
- Python可以开发哪些程序?