记录编号 |
14605 |
评测结果 |
AAAAA |
题目名称 |
复原几何图形 |
最终得分 |
100 |
用户昵称 |
ybh |
是否通过 |
通过 |
代码语言 |
Pascal |
运行时间 |
0.001 s |
提交时间 |
2009-11-02 17:11:52 |
内存使用 |
0.12 MiB |
显示代码纯文本
program resume;
var
b:array[0..51,0..51] of boolean;
c:array[0..51] of boolean;
ans,d:array[0..51] of integer;
n,j,r1,r2,s,j1:integer;
bool:boolean;
procedure zou(step,last:integer);
var
i,i1:integer;
begin
if step=n+1 then
begin
if b[last,1]
then bool:=true;
exit
end;
for i:=1 to n do
if (b[last,i]) and (c[i]=false) then
begin
c[i]:=true;
zou(step+1,i);
if bool then
begin
ans[step]:=i;
exit
end;
c[i]:=false
end
end;
begin
assign(input,'resume.in');
reset(input);
assign(output,'resume.out');
rewrite(output);
readln(n);
fillchar(b,sizeof(b),false);
fillchar(c,sizeof(c),false);
bool:=false;
repeat
readln(r1,r2);
b[r1,r2]:=true;
b[r2,r1]:=true
until (r1=0) or (r2=0);
{for j:=1 to n do
begin
s:=0;
fillchar(d,sizeof(d),0);
for j1:=1 to n do
if b[j,j1] then
begin
inc(s);
d[s]:=j1
end;
if s=2 then
begin
b[d[1],d[2]]:=false;
b[d[2],d[1]]:=false
end
end;}
c[1]:=true;
ans[1]:=1;
zou(2,1);
for j:=1 to n do
write(ans[j],' ');
writeln;
close(input);
close(output)
end.