Pagini recente » Cod sursa (job #2096117) | Cod sursa (job #154561) | Cod sursa (job #3147193) | Cod sursa (job #629837) | Cod sursa (job #387219)
Cod sursa(job #387219)
var s:array[0..16]of byte;
n,i,p:byte;
procedure afsol;
begin
for i:=1 to p-1 do write(s[i],' ');
writeln(s[p]);
end;
procedure back;
begin
fillchar(s,sizeof(s),0);
p:=1;
repeat
if s[p]=0 then s[p]:=s[p-1]+1
else s[p]:=s[p]+1;
if s[p]>n then begin
s[p]:=0;
p:=p-1;
end
else begin
afsol;
if p<n then p:=p+1;
end;
until p<1;
end;
begin
assign(input,'submultimi.in');
reset(input);
assign(output,'submultimi.out');
rewrite(output);
read(n);
back;
close(input);
close(output);
end.