a,b,c:array[0..50001] of longint;
t:array[0..50001] of char;
st:char;
stemp:string;
begin
readln(n);
n4:= (n-1) div 4+1;
fillchar(a,sizeof(a),0);
fillchar(b,sizeof(b),0);
fillchar(c,sizeof(c),0);
fillchar(t,sizeof(t),’0’);
i:=n;
repeat
read(st);
t[i]:=st;
dec(i);
until i=0;
for i:= n4 downto 1 do begin
stemp:=’’;
stemp:=stemp+t[4*i-0];
stemp:=stemp+t[4*i-1];
stemp:=stemp+t[4*i-2];
stemp:=stemp+t[4*i-3];
val(stemp,a[i]);
end;
readln;
fillchar(t,sizeof(t),’0’);
i:=n;
repeat
read(st);
t[i]:=st;
dec(i);
until i=0;
for i:= n4 downto 1 do begin
stemp:=’’;
stemp:=stemp+t[4*i-0];
stemp:=stemp+t[4*i-1];
stemp:=stemp+t[4*i-2];
stemp:=stemp+t[4*i-3];
val(stemp,b[i]);
end;
for i:= 1 to n4 do
for j:= 1 to n4 do begin
c[i+j-1]:=a[i]*b[j]+c[i+j-1];
c[i+j]:= c[i+j]+c[i+j-1] div 10000;
c[i+j-1]:= c[i+j-1] mod 10000;
end;
i:= 50000;
while c[i] = 0 do dec(i);
write(c[i]);
for j:= i-1 downto 1 do begin
write(c[j] div 1000 mod 10);
write(c[j] div 100 mod 10);
write(c[j] div 10 mod 10);
write(c[j] div 1 mod 10);
end;
end.
给我吧
var n,l,i,y,j:longint;
a,b,c:array[0..100006]of qword;
s:ansistring;
begin
readln(n);l:=n;
readln(s);
y:=n;i:=1;
while y>0 do
begin
if y-8>=1 then val(copy(s,y-7,8),a[i]) else
if y>0 then val(copy(s,1,y),a[i]);
inc(i);dec(y,8);
end;
readln(s);
y:=n;i:=1;
while y>0 do
begin
if y-8>=1 then val(copy(s,y-7,8),b[i]) else
if y>0 then val(copy(s,1,y),b[i]);
inc(i);dec(y,8);
end;
n:=i;if a[i]=0 then dec(n);
for i:=1 to n do
for j:=1 to n do
inc(c[1+8*(i+j-1-1)],a[i]*b[j]);
for i:=1 to 2*l+1 do
begin
c[i]:=c[i-1] div 10+c[i];
c[i-1]:=c[i-1] mod 10;
end;
j:=2*l+1;
while c[j]=0 do dec(j);
for i:=j downto 1 do write(c[i]);
end.
