记录编号 4862 评测结果 AAAAAAAATT
题目名称 [USACO 1.5.4] 跳棋的挑战 最终得分 80
用户昵称 GravatarOo湼鞶oO 是否通过 未通过
代码语言 Pascal 运行时间 3.088 s
提交时间 2008-10-22 21:08:44 内存使用 0.11 MiB
显示代码纯文本
{*******************************************}
{* Program name: checker                   *}
{* Input file: checker.in                  *}
{* Output file: checker.out                *}
{* Date: 2008.10.22                        *}
{* Programmer: Peng Bo                     *}
{*******************************************}
program checker;
type
  sz=array[1..14]of byte;
  s1=array[1..14]of boolean;
  s2=array[-13..13]of boolean;
  s3=array[2..28]of boolean;
var
  s:sz;
  a:s1;
  b:s2;
  c:s3;
  n:byte;
  g:longint;
  f:text;
{~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}
procedure main(x:byte);
var
  i:byte;
  {--------------------------}
procedure op;
var
  i:byte;
begin
  inc(g);
  for i:=1 to (n-1) do
    write(f,s[i],' ');
  writeln(f,s[n]);
end;{op}
  {--------------------------}
begin
  for i:=1 to n do
    if a[i] and b[x-i] and c[x+i]
    then
    begin
      s[x]:=i;
      a[i]:=false;
      b[x-i]:=false;
      c[x+i]:=false;
      if x<n
      then
        main(x+1)
      else
        if g<3
        then
          op
        else
          inc(g);
      a[i]:=true;
      b[x-i]:=true;
      c[x+i]:=true;
    end;
end;{main}
{~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}
procedure cs;
var
  i:byte;
begin
  for i:=1 to n do
    a[i]:=true;
  for i:=2 to (2*n) do
    c[i]:=true;
  for i:=0 to (2*n-2) do
    b[i-n+1]:=true;
  g:=0;
end;{cs}
{~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}
begin
  assign(f,'checker.in');
  reset(f);
  read(f,n);
  close(f);
  {===========}
  cs;
  {===========}
  assign(f,'checker.out');
  rewrite(f);
  {===========}
  main(1);
  {===========}
  write(f,g);
  close(f);
end.