Ant Trip Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 1107 Accepted Submission(s): 404 Problem Description Ant Country consist of N towns.There are M roads connecting the towns.Ant Tony,t…
题目给出图,要求判断不能一遍走完所有边,也就是无向图,题目分类是分欧拉回路,但其实只要判断度数就行了. 一开始以为只要判断度数就可以了,交了一发WA了.听别人说要先判断是否是联通图,于是用并查集并一起,然后判断是否有多个根. 用dfs的话就是深搜时标记下,最后看看有没有全部标记.我没用dfs做. 代码: #include <cstdio> const int maxn = 201; int f[maxn]; int d[maxn]; int find(int x) { if (x != f[x…
转自:http://blog.csdn.net/shahdza/article/details/7779385 欧拉回路[HDU]1878 欧拉回路 判断3018 Ant Trip 一笔画问题1116 Play on Words2894 DeBruijin 兹鼓欧拉回路1956 Sightseeing tour 混合欧拉3472 HS BDC 混合欧拉=========================================================================…