HDU 1878 欧拉回路
来源:互联网 发布:风电中国 知乎 编辑:程序博客网 时间:2024/06/05 22:47
欧拉回路
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 10254 Accepted Submission(s): 3745
束。
3 31 21 32 33 21 22 30
10
/* ***********************************************
Author :
Created Time :2015/6/2 16:01:09
File Name :2.cpp
************************************************ */
#include <iostream>
#include <cstring>
#include <cstdlib>
#include <stdio.h>
#include <algorithm>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <string>
#include <math.h>
#include <stdlib.h>
#include <iomanip>
#include <list>
#include <deque>
#include <stack>
#define ull unsigned long long
#define ll long long
#define mod 90001
#define INF 1<<30
#define maxn 1000+10
#define cle(a) memset(a,0,sizeof(a))
const ull inf = 1LL << 61;
const double eps=1e-5;
using namespace std;
bool cmp(int a,int b){
return a>b;
}
vector<int>v[maxn];
int vis[maxn];
int n,m;
int mark;
int indegree[maxn];
void gett(int cur){
for(int i=0;i<v[cur].size();i++){
int u=v[cur][i];
if(!vis[u]){
vis[u]=1;
gett(u);
}
}
}
int main()
{
#ifndef ONLINE_JUDGE
//freopen("in.txt","r",stdin);
#endif
//freopen("out.txt","w",stdout);
while(cin>>n&&n){
cin>>m;
mark=0;
for(int i=0;i<maxn;i++)
v[i].clear();
int a,b;
cle(indegree);
for(int i=1;i<=m;i++){
scanf("%d%d",&a,&b);
indegree[a]++;
indegree[b]++;
v[a].push_back(b);
v[b].push_back(a);
}
cle(vis);
mark=0;
vis[1]=1;
gett(1);
for(int i=1;i<=n;i++)
if(!vis[i]){
mark=1;break;
}
int mark1=0;
if(mark)printf("%d\n",0);
else{
for(int i=1;i<=n;i++){
if(indegree[i]&1)if(indegree[i]!=0)
mark1=1;
}
if(mark1)printf("%d\n",0);
else printf("%d\n",1);
}
}
return 0;
}
- HDU 1878 欧拉回路
- hdu 1878 欧拉回路
- 【欧拉回路】hdu 1878
- hdu 1878 欧拉回路
- HDU 1878 欧拉回路
- hdu 1878 欧拉回路
- hdu 1878 欧拉回路
- hdu 1878 欧拉回路
- HDU-1878-欧拉回路
- Hdu 1878 欧拉回路
- hdu 1878 欧拉回路
- hdu 1878 欧拉回路
- hdu 1878 欧拉回路
- HDU 1878 欧拉回路
- hdu 1878 欧拉回路
- hdu 1878 欧拉回路
- HDU-1878 欧拉回路
- HDU 1878 欧拉回路
- 广义表的基本操作实现
- Codeforces Beta Round #4 (Div. 2 Only)
- Codeforces Beta Round #5
- Providing Resource
- leetcode——338——Counting Bits
- HDU 1878 欧拉回路
- Codeforces Beta Round #6 (Div. 2 Only)
- Codeforces Beta Round #7
- Codeforces Beta Round #8
- HDU 1215七夕节
- 2015年06月17日
- Activity之封装intent
- Greedy Gift Givers
- DINIC 模板