procedure multiply(a:hp;b:longint;var c:hp); var i,len:integer; begin fillchar(c,sizeof(c),0); len:=a[0]; for i:=1 to len do begin inc(c[i],a[i]*b); inc(c[i+1],(a[i]*b) div 10); c[i]:=c[i] mod 10; end; inc(len); while (c[len]>=10) do begin {处理最高位的进位} c[len+1]:=c[len] div 10; c[len]:=c[len] mod 10; inc(len); end; while (len>1) and (c[len]=0) do dec(len); {若不需进位则调整len} c[0]:=len; end;{multiply}