[[dama_pas]]
 
program dama;
 
const n=8;
var a : array [1..n] of integer;
 
procedure umisti (k:integer);
var i,j,p:integer;
  ok:boolean;
begin
  for i:=1 to n do begin
    a[k]:=i;
    ok:=true;
 
    for p:=1 to k-1 do
      if (a[p]=i) or (a[p]=i-(k-p)) or (a[p]=i+k-p) then ok:=false;
 
      if ok = true then begin
       if k<n then umisti (k+1)
              else begin
                 for j:=1 to n do write(a[j],' ');
                 writeln;
              end;
    end;
  end;
end;
begin
   umisti (1);
   readln;
end.
 
dama_pas.txt · Last modified: 2014/04/03 13:58 by 147.32.8.115
 
Recent changes RSS feed Creative Commons License Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki