Title "Type your title here";
constant N = 8; //皇后数目,可改动
IntParameter position(0:N-1)[0,n-1];
Exclusive = True;
Minimum;
StartProgram;
var i, j, d: integer;
begin
d := 0;
for i := 0 to N-1 do begin
for j := i to N-1 do
if (abs(position-position[j]) = abs(i-j))or(position = position[j]) then
inc(d);
end;
FunctionResult := d;
end;
EndProgram;