#include<cstdio> #include<iostream> #include<stack> #include<cmath> using std::stack; using std::min;
constint MAXN = 40000 + 5;
namespace m1 { structed { int to, nex, frm; } e[MAXN]; int head[MAXN]; int newp = 1; int low[MAXN], dfn[MAXN], out[MAXN]; int tim; int dcnt;//双联通分量编号 int dcolor[MAXN];//双联通分量染色 bool bridge[MAXN]; voidinsert(int p1, int p2); voidtarjan(int p, int ed); voiddfs(int p); }
int n, m;
intmain(void){ { usingnamespace m1; scanf("%d%d", &n, &m); for (int i = 1; i <= m; ++i) { int x, y; scanf("%d%d", &x, &y); insert(x, y); insert(y, x); } tarjan(1, 0); for (int i = 1; i <= n; ++i) { if (!dcolor[i]) { ++dcnt; dfs(i); } } for (int i = 1; i <= m; ++i) { if (dcolor[e[i * 2].frm] != dcolor[e[i * 2].to]) { ++out[dcolor[e[i * 2].frm]]; ++out[dcolor[e[i * 2].to]]; } } int leaf = 0; for (int i = 1; i <= dcnt; ++i) { if (out[i] == 1) { ++leaf; } } printf("%d\n", leaf == 1 ? 0 : (leaf + 1) / 2); } return0; }