高精度除法的优化 pascal
来源:百度知道 编辑:UC知道 时间:2024/09/23 04:44:53
2.3高精度乘法
1.高精度乘单精度(1位数)
程序如下:
program HighPrecision3_Multiply1;
const
fn_inp='hp3.inp';
fn_out='hp3.out';
maxlen=100; { max length of the number }
type
hp=record
len:integer; { length of the number }
s:array[1..maxlen] of integer
{ s[1] is the lowest position
s[len] is the highest position }
end;
var
x,y:hp; { x:input hp ; y:output }
z:integer; { z:input lp }
procedure PrintHP(const p:hp);
var i:integer;
begin
for i:=p.len downto 1 do write(p.s[i]);
end;
procedure init;
var
st:string;
i:integer;
begin
assign(input,fn_inp);
reset(input);
readln(st);
x.len:=length(st);
for i:=1 to x.len do { change string to HP }
x.s[i]:=ord(st[x.len+1-i])-ord('0');
readln(z);