POJ1144
来源:互联网 发布:使用excel制作软件 编辑:程序博客网 时间:2024/06/05 02:25
求割点
# include <cstdio># include <cstdlib># include <cctype># include <cmath># include <ctime># include <cstring># include <string># include <iostream># include <algorithm>using namespace std;struct P{int to;int next;};P a[20005];int n,first[101],tot,root=1;int low[101],num[101],flag,index;void f(int i,int j){tot++;a[tot].next=first[i];a[tot].to=j;first[i]=tot;}void dfs(int cur,int father){int child=0,u,flag1=0;index++;low[cur]=index;num[cur]=index;u=first[cur];while(u!=0){if(num[a[u].to]==0){child++;dfs(a[u].to,cur);low[cur]=min(low[cur],low[a[u].to]);if(cur!=root && low[a[u].to]>=num[cur]) flag1=1;if(cur==root && child==2) flag1=1;}else if(a[u].to!=father) low[cur]=min(low[cur],num[a[u].to]);u=a[u].next;}if(flag1==1) flag++;return ;}int main(){//freopen("1.in","r",stdin);//freopen("1.out","w",stdout);int end,i,j;scanf("%d",&end);do{n=end;tot=0;flag=0;index=0;fill(low,low+101,0);fill(num,num+101,0);fill(first,first+101,0);while(scanf("%d",&i)&&i!=0){ while(getchar()!='\n') { scanf("%d",&j); f(i,j); f(j,i); } } dfs(1,1); cout<<flag<<endl;}while(scanf("%d",&end)&&end!=0);return 0;}
0 0
- POJ1144
- poj1144
- POJ1144
- poj1144
- poj1144 Network
- poj1144 Network
- POJ1144--Network
- 找割点poj1144
- poj1144 network
- 【poj1144】 Network
- poj1144-Network
- POJ1144 Network 求割点
- poj1144-tarjan求割点
- poj1144-Network(求割点)
- poj1144 求割点 模版题
- POJ1144 Network(求割点)
- poj1144 tarjan求割点
- POJ1144——Network
- javascript中的String
- 8.3 聚类(Clustering) hierarchical clustering 层次聚类
- jquery给动态dom绑定事件
- GIT基本教程
- Java IO工作机制分析
- POJ1144
- Java环境搭建(JDK+MyEclipse+Maven+Resin)
- android 6.0 优先网络类型设置流程(Preferrred network type)
- error: ‘PATH_MAX’ undeclared (first use in this function)
- c#中将json数据转换为dictionary并取出某个元素显示
- Redis学习笔记(九)redis 配置文件详解
- NSURLSession的下载和断点继传以及后台下载功能
- 夜半游白岛心安随笔记
- dfs