标签:训练 for ext class euler list ace null system
for(int i=0; i!=n; ++i)
{
int u = cin.nextInt();
int v = cin.nextInt();
edges.add(new Edge(u,v));
startpnt = u;
if(g.get(u)==null) g.put(u, new ArrayList<Integer> ());
g.get(u).add(edges.size()-1);
edges.add(new Edge(v,u));
if(g.get(v)==null) g.put(v, new ArrayList<Integer> ());
g.get(v).add(edges.size()-1);
}
boolean ok = true;
for(int i=1;i<=n;++i)
{
if(g.get(i)==null) continue;
if(g.get(i).size()%2==1)
{
ok=false;
break;
}
}
if(ok) euler(startpnt);
System.out.println("Case #"+kase);
if(ok && stack.size()==n)
{
while(!stack.isEmpty())
{
System.out.println(stack.peek().u+" "+stack.peek().v);
stack.pop();
}
}
else
{
System.out.println("some beads may be lost");
}
System.out.println();
}
}
}
标签:训练 for ext class euler list ace null system
原文地址:https://www.cnblogs.com/samhx/p/UVa-10054.html