文章列表
 
您正在查看 "欧拉回路" 分类下的文章

2010-03-05 21:46

//无向图是否存在欧拉回路的两个判定条件
条件1:连通、
条件2:所有的点均为偶度的点
#include <iostream>
#include <vector>
using namespace std;
const int maxn = 1001;
int N, M;
vector<int>adj[maxn];
vector<int>Q;
bool flag[maxn];
int degree[maxn];
int u, v;
int tot = 0;
bool can()
{
for (int i=1; i<=N; i++)
{
if(degree[i]%2) return false;
}
return true;
}
void dfs(int node)

 
2010-03-04 22:01

//这个题奇怪的地方还真不少.,

在别人的代码里发现会出现in[i]==0&&out[i]==0的情况,因为去掉这段语句就会WA,真不明白怎么会有这种情况,还有一点,欧拉回路和欧拉通路都适合于要求。我之前提交忽略了欧拉回路,最后加上一句if(c1==0 && c2==0) return true;就AC了

#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
using namespace std;
#defin

 
 
   
 
 
文章存档
 
     
 
最新文章评论
  

条理很清晰
 

什么是多重队列?跪求!!!
 

orz ...
 

请问这个代码,错在什么地方了?一直是 running time error 我是不是少考虑了什么条
 

#include<iostream> #include<algorithm> #include<string.h> using namespace std;
   
帮助中心 | 空间客服 | 投诉中心 | 空间协议
©2012 Baidu