来自本人百度空间 2009-08-20 16:48
program gaojingdu(input,output);
var
str1,str2:string;
a,b,c:array[1..10000] of integer;
l1,l2,i,j,g,s,z,top:longint;
begin
assign(input,'gaojingdu.in');
reset(input);
assign(output,'gaojingdu.out');
rewrite(output);
readln(str1);
readln(str2);
close(input);
l1:=length(str1); l2:=length(str2);
for i:=l1 downto 1 do a[l1-i+1]:=ord(str1[i])-ord('0');
for i:=l2 downto 1 do b[l2-i+1]:=ord(str2[i])-ord('0');
fillchar(c,sizeof(c),0);
s:=0; g:=0; z:=0;
for i:=1 to l2 do
for j:=1 to l1 do begin
z:=b[i]*a[j];
g:=z mod 10;
s:=z div 10;
top:=i+j-1;
c[top]:=c[top]+g;
c[top+1]:=c[top+1]+c[top] div 10 +s;
c[top]:=c[top] mod 10;
end;{jisuan}
top:=l1+l2;
while c[top]=0 do dec(top);
for i:=top downto 1 do write(c[i]);
close(output);
end.
网上一傻X竟然给错误程序
还好我脑子好使没上当~~~