Код:
var
i, j, n, i1, f : longint; t, temp : ansistring;
procedure umn(x,y : ansistring; var t : ansistring);
var
a, b, c : array[1..10000] of int64;
n, m, i, k, f : longint; temp : ansistring;
begin
t := '';
n := length(x);
m := length(y);
for i := n downto 1 do
val(x[i], a[n-i+1], f);
for i := m downto 1 do
val(y[i], b[m-i+1], f);
for i := 1 to m + n do
c[i] := 0;
for i := 1 to n do
for j := 1 to m do
begin
c[i+j-1] := a[i] * b[j] + c[i+j-1];
end;
for i := 1 to n+m-1 do
begin
c[i+1] := c[i+1] + c[i] div 10;
c[i] := c[i] mod 10;
end;
k := n + m;
while (k>1) and (c[k] = 0) do
dec(k);
for i := k downto 1 do
begin
str(c[i], temp);
t := t + temp;
end;
end;
begin
readln(n);
if (n = 0) then
writeln('1')
else
begin
t := '1';
for i := 2 to n do
begin
temp := '';
str(i, temp);
umn(t, temp, t);
end;
writeln(t);
end;
end.Отредактировано Илья (2011-05-20 10:26:06)
