这么急?是不是明天叫作业?给你了。懒得写注释,我可在上课啊~~~~~~~~
var
x:array[1..8] of integer;
a,b,c:array[-7..16] of boolean;
i:integer;
procedure print;
var
k:integer;
begin
for k:=1 to 8do
write(x[k]:4);
writeln
end;
{print}
procedure try(i:integer);
var
j:integer;
begin
for j:=1 to 8do
if a[j] and b[i+j] and c[i-j]
then
begin
x:=j;
a[j]:=false;
c[i-j]:=false;
if i<8
then
try(i+1)
else
print;
a[j]:=true;
b[i+j]:=true;
c[i-j]:=true;
end
end;
begin
a:=true;
b:=true;
c:=true
end;
try(1)
end.