Реферат: Механизм бектрекинга
b [level]: =level;
level: =level-1;
end;
function add_element (d: integer): integer;
var
i: integer;
q: boolean;
begin
repeat
q: =true;
for i: =1 to level do
if s [i] >=d then q: =false;
if q then add_element: =d
else
begin
d: =d+1;
if d>n then
begin
add_element: =0;
q: =true;
end;
end;
until q
end;
begin
clrscr;
read (n);
for i: =1 to n do
begin