program sachy; type bytearray = array[1..8] of byte; var results:bytearray; res :boolean; procedure napisReseni; var i:byte; begin for i:=1 to 8 do begin write(results[i],' '); end; writeln; end; function otestuj(col, row :byte):boolean; var plus,tmp,i:byte; begin if (row = 1) then otestuj:= true; plus:= 1; tmp:= 0; i:= row - 1; while (i > 0) do begin if (col = results[i]) then otestuj:= false; tmp:= col + plus; if (tmp = results[i]) then otestuj:= false; tmp:= col - plus; if (tmp = results[i]) then otestuj:= false; plus:= plus + 1; i:= i - 1; end; otestuj:= true; end; function init(col,row :byte):boolean; var tst :boolean; dalsi:byte; begin tst:=otestuj(col,row); if (tst = false) then init:=false; results[row]:= col; if (row = 8) then begin napisReseni; init:=false; end; dalsi:= row + 1; init(1,dalsi); init(2,dalsi); init(3,dalsi); init(4,dalsi); init(5,dalsi); init(6,dalsi); init(7,dalsi); init(8,dalsi); end; begin res:=init(0,0); end.