记录编号 14636 评测结果 AAAAA
题目名称 复原几何图形 最终得分 100
用户昵称 Gravatarreamb 是否通过 通过
代码语言 Pascal 运行时间 0.001 s
提交时间 2009-11-02 18:18:38 内存使用 0.11 MiB
显示代码纯文本
program pianfen;
var
  n,j,k,a,b:integer;
  shu:array[1..50]of integer;
  biaozhi:array[0..50,0..50]of boolean;
  jilu:array[1..50]of boolean;
procedure jisuan(step:integer);
var
  i:integer;
begin
  if step>n then
    exit;
  for i:=2 to n do
    if (biaozhi[shu[step-1],i]=true)and(jilu[i]=false)then
    begin
      shu[step]:=i;
      jilu[i]:=true;
      if (step=n)and(biaozhi[1,i]=true) then
      begin
        write ('1',' ');
        for j:=2 to n do
          write (shu[j],' ');
        writeln;
        close (input);
        close (output);
        halt
      end
      else
        jisuan(step+1);
      jilu[i]:=false;
      shu[step]:=0
    end
end;
begin
  assign (input,'resume.in');
  reset (input);
  assign (output,'resume.out');
  rewrite (output);
    readln (n);
    for k:=1 to n do
      for j:=1 to n do
        biaozhi[k,j]:=false;
    repeat
      readln (a,b);
      biaozhi[a,b]:=true;
      biaozhi[b,a]:=true
    until a=0;
   for k:=1 to n do
     jilu[k]:=false;
   jilu[1]:=true;
   shu[1]:=1;
   jisuan (2);
  writeln (n);
  close (input);
  close (output)
end.