program checker(input,output);
var
a:array[1..14]of integer;
s:longint;
n:integer;
procedure print;
var i:integer;
begin
for i:=1 to n do write(output,a[i],' ');
writeln(output);
end;
procedure search(t:integer);
var i,j:integer;b:boolean;
begin
for i:=1 to n do
begin
b:=false;
for j:=1 to t-1 do
if(i=a[j])or(abs(t-j)=abs(i-a[j]))then b:=true;
if not b then begin
a[t]:=i;
if t<n then search(t+1)
else begin
if s<3 then print;
s:=s+1;
end;
end;
end;
end;
begin
assign(input,'checker.in');assign(output,'checker.out');
reset(input);rewrite(output);
read(input,n);
if n<12 then begin
s:=0;
search(1);
write(output,s);
end;
close(input);close(output);
end.
program checker(input,output);
var
a:array[1..14]of integer;
s:longint;
n:integer;
procedure print;
var i:integer;
begin
for i:=1 to n do write(output,a[i],' ');
writeln(output);
end;
procedure search(t:integer);
var i,j:integer;b:boolean;
begin
for i:=1 to n do
begin
b:=false;
for j:=1 to t-1 do
if(i=a[j])or(abs(t-j)=abs(i-a[j]))then b:=true;
if not b then begin
a[t]:=i;
if t<n then search(t+1)
else begin
if s<3 then print;
s:=s+1;
end;
end;
end;
end;
begin
assign(input,'checker.in');assign(output,'checker.out');
reset(input);rewrite(output);
read(input,n);
if n<12 then begin
s:=0;
search(1);
write(output,s);
end;
close(input);close(output);
end.
中文繁體 中文简体
2014-07-13 16:49:56 以 Twitter Bootstrap 作为界面框架,应用 bootstrap 主题。 进程运行 0.0159 s ,处理完成数据库 8 次。
(