状态题目:A*B Problem
题目编号:377-A*B Problem 查看该题
状态: Running
测评机: Xeost[5]
得分: 0分
提交日期: 2009-7-25 18:41:00
有效耗时: 该状态没有记录
提交代码: program r377;
type arr=array [0..5005] of qword;
var i,j,k,n,l,temp:longint;
s,s2:ansistring;
a,b:arr;
c:array [1..11000] of qword;
begin
readln(l);
readln(s);
readln(s2);
j := l mod 8;
temp := l div 8;
if j>0 then begin
val(copy(s,1,j),a[temp+1]);
delete(s,1,j);
a[0] := temp+1;
end
else a[0] := temp;
for i := 1 to temp do val(copy(s,8*i-7,8),a[temp-i+1]);
if j>0 then begin
val(copy(s2,1,j),b[temp+1]);
delete(s2,1,j);
b[0] := temp+1;
end
else b[0] := temp;
for i := 1 to temp do val(copy(s,8*i-7,8),b[temp-i+1]);
for i := 1 to b[0] do begin
for j := 1 to a[0] do c[i+j-1] := c[i+j-1]+b[i]*a[j];
for j := 1 to a[0]+i do if c[j]>=100000000 then begin
c[j+1] := c[j+1]+c[j] div 100000000;
c[j] := c[j] mod 100000000;
end;
end;
temp := a[0]+b[0]+1;
while c[temp]=0 do dec(temp);
write(c[temp]);
for i := temp-1 downto 1 do begin
if c[i]<10000000 then begin
write(0);
if c[i]<1000000 then begin
write(0);
if c[i]<100000 then begin
write(0);
if c[i]<10000 then begin
write(0);
if c[i]<1000 then begin
write(0);
if c[i]<100 then begin
write(0);
if c[i]<10 then write(0);
end;
end;
end;
end;
end;
end;
write(c[i]);
end;
end.