Zcus @ 2017-04-24 16:49:44
#include<cstdio>
#include<iostream>
#include<algorithm>
using namespace std;
int g[2000][2000];
int a[2000],d[2000];
int n,ss,p=0,pig,zzm;
void dfs(int i)
{
int j;
for(j=1;j<=n;j++)
{
if(g[i][j]>0)
{
g[i][j]--;
g[j][i]--;
dfs(j);
}
}
a[++p]=i;
}
int main()
{ int i;
scanf("%d",&n);int x,y;
for(i=1;i<=n;i++)
{
scanf("%d%d",&x,&y);
g[x][y]++;
g[y][x]++;
d[x]++;
d[y]++;
zzm=max(max(x,y),zzm);
}
ss=1;
for(i=1;i<=zzm;i++)
{
if(d[i]%2==1)
{
ss=i;
break;
}
}
dfs(ss);
for(i=p;i>=1;i--)
printf("%d\n",a[i]);
return 0;
}
by lxyhhhhhh @ 2017-10-01 18:05:42
@zzminclude
可能是你的dfs里 j 的范围错了
by HeCao2008 @ 2022-08-15 13:38:52
考古