高精度乘这样写对么?
constmet=250;vari,j,la,lb,len:longint;sa,sb:string;m:longint;a:array[1..met]oflongint...
const met=250;
var
i,j,la,lb,len:longint;
sa,sb:string;
m:longint;
a:array[1..met]of longint;
b:array[1..met]of longint;
c:array[1..met]of longint;
begin
readln(sa);
readln(sb);
la:=length(s1);
for i:=1 to la do a[i]:=ord(sa[la-i+1])-48;
lb:=length(s2);
for i:=1 to lb do b[i]:=ord(sb[lb-i+1])-48;
for i:=1 to la do
for j:=1 to lb do
c[i+j-1]:=c[i+j-1]+a[i]*b[j];
len:=la+lb;
for i:=1 to len do
begin
c[i+1]:=c[i+1]+c[i] div 10;
c[i]:=c[i] mod 10;
end;
while c[len]=0 do dec(len);
m:=c[len];
while m>0 do
begin
c[len]:=m mod 10;
m:=m div 10;
inc(len);
end;
for i:=len-1 downto 1 do
write(c[i]);
end. 展开
var
i,j,la,lb,len:longint;
sa,sb:string;
m:longint;
a:array[1..met]of longint;
b:array[1..met]of longint;
c:array[1..met]of longint;
begin
readln(sa);
readln(sb);
la:=length(s1);
for i:=1 to la do a[i]:=ord(sa[la-i+1])-48;
lb:=length(s2);
for i:=1 to lb do b[i]:=ord(sb[lb-i+1])-48;
for i:=1 to la do
for j:=1 to lb do
c[i+j-1]:=c[i+j-1]+a[i]*b[j];
len:=la+lb;
for i:=1 to len do
begin
c[i+1]:=c[i+1]+c[i] div 10;
c[i]:=c[i] mod 10;
end;
while c[len]=0 do dec(len);
m:=c[len];
while m>0 do
begin
c[len]:=m mod 10;
m:=m div 10;
inc(len);
end;
for i:=len-1 downto 1 do
write(c[i]);
end. 展开
1个回答
库来特
2024-08-20 广告
2024-08-20 广告
使用高精度夹头的好处在于能够显著提升加工精度与效率。高精度的夹持系统能确保工件在加工过程中保持稳固不移位,有效减少振动和偏差,从而生产出更符合设计要求的产品。此外,它还加快了换装工件的速度,减少了调整时间,提高了生产线的整体自动化程度和工作...
点击进入详情页
本回答由库来特提供
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询