Data update
This commit is contained in:
parent
8e4e15fa56
commit
72eb4943cb
1853 changed files with 35514 additions and 9441 deletions
17
Task/N-queens-problem/PascalABC.NET/n-queens-problem.pas
Normal file
17
Task/N-queens-problem/PascalABC.NET/n-queens-problem.pas
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
const
|
||||
N = 8;
|
||||
|
||||
begin
|
||||
var cols := (1..N);
|
||||
var solutions := 0;
|
||||
foreach var vec in cols.Permutations do
|
||||
if (N = cols.Select(n -> vec[n - 1] + n).ToSet.Count) and
|
||||
(N = cols.Select(n -> vec[n - 1] - n).ToSet.Count) then
|
||||
begin
|
||||
solutions += 1;
|
||||
// foreach var col in ('a'..'h') index i do
|
||||
// write(col, vec[i], ' ');
|
||||
// write(if solutions mod 4 = 0 then #10 else ' ');
|
||||
end;
|
||||
writeln('Solutions: ', solutions);
|
||||
end.
|
||||
Loading…
Add table
Add a link
Reference in a new issue