比赛 |
暑假培训二 |
评测结果 |
AAAAATTATT |
题目名称 |
跳棋的挑战 |
最终得分 |
60 |
用户昵称 |
zhai |
运行时间 |
0.000 s |
代码语言 |
Pascal |
内存使用 |
0.00 MiB |
提交时间 |
2008-07-18 11:20:54 |
显示代码纯文本
program checker;
var
a,b:array[1..14,1..14]of integer;
f1,f2:text;
n:integer;
c:longint;
procedure tian(i,j:integer);
var
k,l:integer;
begin
for k:=1 to n do
for l:=1 to n do begin
if (k-l=i-j)and(k<>i)and(l<>j) then inc(b[k,l]);
if (k+l=i+j)and(k<>i)and(l<>j) then inc(b[k,l]);
end;
for k:=1 to n do begin
if k<>j then inc(b[i,k]);
inc(b[k,j]);
end;
end;
procedure huif(i,j:integer);
var
k,l:integer;
begin
for k:=1 to n do
for l:=1 to n do begin
if (k-l=i-j)and(k<>i)and(l<>j) then dec(b[k,l]);
if (k+l=i+j)and(k<>i)and(l<>j) then dec(b[k,l]);
end;
for k:=1 to n do begin
if k<>j then dec(b[i,k]);
dec(b[k,j]);
end;
end;
procedure init;
begin
assign(f1,'checker.in');reset(f1);
assign(f2,'checker.out');rewrite(f2);
read(f1,n);
close(f1);
end;
procedure try(i:integer);
var
j,k,l:integer;
begin
for j:=1 to n do begin
if (i<=n)and(b[i,j]=0) then
begin
a[i,j]:=1;
tian(i,j);
if i=n then
begin
inc(c);
if (c>0)and(c<4) then begin
for k:=1 to n do
for l:=1 to n do
if a[k,l]=1 then write(f2,l,' ');
writeln(f2);
end;
end
else try(i+1);
a[i,j]:=0;
huif(i,j);
end;
end;
end;
begin
fillchar(a,sizeof(a),0);
fillchar(b,sizeof(b),0);
init;
c:=0;
try(1);
write(f2,c);
close(f2);
end.