比赛 20140713下午练习 评测结果 AAAAAWWAWW
题目名称 跳棋的挑战 最终得分 60
用户昵称 天空非翔 运行时间 0.131 s
代码语言 Pascal 内存使用 0.17 MiB
提交时间 2014-07-13 16:21:29
显示代码纯文本
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.