猿问

求助,关于pascal高精乘(函数)!

麻烦告诉一下!~谢谢

千巷猫影
浏览 200回答 2
2回答

明月笑刀无情

program aa;type gao=array[1..100]of integer;var x1,x2,y:gao;s,s1,s2,s3:ansistring;function cheng(a,b:ansistring):ansistring;var i,j,x,m,n:integer;beginn:=length(a);m:=length(b);for i:=1to n doval(a[i],x1[n-i+1]);for i:=1to m doval(b[i],x2[m-i+1]);for i:=1to n dobeginx:=0;for j:=1to m dobeginx:=x1[i]*x2[j]+x div 10+y[i+j-1];y[i+j-1]:=x mod 10;end;y[i+j]:=x div 10;end;n:=m+n;while (y[n]=0)and(n>1)do dec(n);for i:=1to n dobeginstr(y[n-i+1],s1);s:=s+s1;end;cheng:=s;end;beginreadln(s1);readln(s2);write(cheng(s1,s2));end.

饮歌长啸

program gaojinduchengfa;vari,j,k,l,m,n:longint;a,b,c:array[1..200000] of longint;x,y:array[1..100000]of char;beginm:=0;n:=0;while not seekeoln do begininc(m);read(x[m]);end;readln;while not seekeoln do begininc(n);read(y[n]);end;for i:=m downto 1 do a[m-i+1]:=ord(x[i])-ord('0');for i:=n downto 1 do b[n-i+1]:=ord(y[i])-ord('0');for i:=1 to m dofor j:=1 to n doc[i+j-1]:=c[i+j-1]+a[i]*b[j];for j:=1 to n+m do beginc[j+1]:=c[j+1]+c[j] div 10;c[j]:=c[j] mod 10;end;l:=m+n;while c[l]=0 do dec(l);for i:=l downto 1 do write(c[i]);end.
随时随地看视频慕课网APP

相关分类

Java
Python
我要回答