大家帮我看看haiwei这个程序有什么问题.
题目:求S=1!+2!+……+n!(n>=50);
program s;
const maxlen=10000;
type
high=record
s:array[0..maxlen]of integer;
len:longint;
end;
var ss,a:high;
i,j,k,n:longint;
procedure jia(a,b:high;var c:high);
var i,len,j:longint;
t:high;
begin
if a.len<b.len then
begin
t:=a;a:=b;b:=t;
end;
len:=a.len;
{writeln('+',a.len);
for i:=a.len downto 0 do
write(a.s);
writeln;}
for i:=b.len+1 to len do
b.s:=0;
j:=0;
for i:=1 to len do
begin
c.s:=a.s+b.s+j;
if c.s>9 then begin j:=1;c.s:=c.s-10; end
else j:=0;
end;
if j>0 then begin c.len:=len+1;c.s[len]:=1; end
else c.len:=len;
{writeln('!',c.len);
for i:=c.len downto 0 do
write(c.s);
writeln;}
end;
procedure chen(a:high;b:longint;var c:high);
var i,j:longint;
begin
for i:=1 to c.len do
c.s:=0;
j:=0;
for i:=1 to a.len do
begin
c.s:=a.s*b+j;
if c.s>9 then
begin
j:=c.s div 10;
c.s:=c.s mod 10;
end;
end;
c.len:=a.len;
if j>0 then
begin
inc(c.len);
c.s[c.len]:=j;
end;
{ while j>=0 do
begin
inc(c.s[c.len+1],c.s[c.len]div 10);
c.s[c.len]:=c.s[c.len]mod 10;
inc(c.len);
end;}
end;
begin
readln(n);
ss.len:=1;
ss.s[0]:=0;
ss.s[1]:=0;
for i:=1 to n do
begin
a.len:=1;
a.s[1]:=1;
for j:=2 to i do
chen(a,j,a);
{writeln('*!',a.len);}
jia(a,ss,ss);
{writeln(ss.len);
for k:=ss.len downto 1 do
write(ss.s[k]);
writeln;}
end;
{writeln(ss.len);}
for k:=ss.len downto 1 do
write(ss.s[k]);
end.