当前位置: 首页 > news >正文

ae模板素材网站根据颜色找网站

ae模板素材网站,根据颜色找网站,自己做的网站可以挂在哪里,别人怎么看见我做的网站题意#xff1a; 存在n个电话公司的网络连接站点#xff0c;每个站点之间相互连通#xff0c;是一个连通图#xff0c;问#xff0c;如果去掉一个站点#xff0c;能够将整个网络体系变得不再连通#xff0c;那么这样的点有几个#xff0c;即求它的割点个数。 题目 存在n个电话公司的网络连接站点每个站点之间相互连通是一个连通图问如果去掉一个站点能够将整个网络体系变得不再连通那么这样的点有几个即求它的割点个数。 题目 A Telephone Line Company (TLC) is establishing a new telephone cable network. They are connecting several places numbered by integers from 1 to N. No two places have the same number. The lines are bidirectional and always connect together two places and in each place the lines end in a telephone exchange. There is one telephone exchange in each place. From each place it is possible to reach through lines every other place, however it need not be a direct connection, it can go through several exchanges. From time to time the power supply fails at a place and then the exchange does not operate. The officials from TLC realized that in such a case it can happen that besides the fact that the place with the failure is unreachable, this can also cause that some other places cannot connect to each other. In such a case we will say the place (where the failure occured) is critical. Now the officials are trying to write a program for finding the number of all such critical places. Help them. Input The input file consists of several blocks of lines. Each block describes one network. In the first line of each block there is the number of places N 100. Each of the next at most N lines contains the number of a place followed by the numbers of some places to which there is a direct line from this place. These at most N lines completely describe the network, i.e., each direct connection of two places in the network is contained at least in one row. All numbers in one line are separated by one space. Each block ends with a line containing just ‘0’. The last block has only one line with N 0. Output The output contains for each block except the last in the input file one line containing the number of critical places. Sample Input 5 5 1 2 3 4 0 6 2 1 3 5 4 6 2 0 0 Sample Output 1 2 分析 无向图中如果有一个顶点删除这个顶点以及这个顶点相关联的边以后图的连通分量增多就称这个点集为割点。 判断一个顶点是不是割点除了从定义还可以从DFS深度优先遍历的角度出发。我们先通过DFS定义两个概念。 假设DFS中我们从顶点U访问到了顶点V此时顶点V还未被访问过那么我们称顶点U为顶点V的父顶点V为U的孩子顶点。 在顶点U之前被访问过的顶点我们就称之为U的祖先顶点。 显然如果顶点U的所有孩子顶点可以不通过父顶点U而访问到U的祖先顶点那么说明此时去掉顶点U不影响图的连通性U就不是割点。 相反如果顶点U至少存在一个孩子顶点必须通过父顶点U才能访问到U的祖先顶点那么去掉顶点U后顶点U的祖先顶点和孩子顶点就不连通了说明U是一个割点。 情况11.u为当前搜索树的根结点且u的子树数量大于1 即 (xfson2) 情况22.u不为根且存在树边(u,v)使dfn(u)low(v) 对应(low[v] dfn[x] x ! f) AC代码 #include stdio.h #include string.h #include algorithm using namespace std; const int N 1e310; const int M 1e610; struct node {int v,next;int u; } s[M]; int ans ; int n,a,b; int dp[N]; int top,num; int dfn[N],low[N]; int cut[N];//标记是否为割点 int id; void tarjan(int x,int f) //当前结点以及父节点 {low[x] dfn[x] id; //(1)结点u初值int son 0; //定义根结点孩子个数for(int i dp[x]; ~i; i s[i].next)//(2)枚举每一条边{int v s[i].v;//(3)入过结点u为强连通分量的根节点时if(!dfn[v]) //(4)没有被访问时候递归搜索{tarjan(v,x);low[x] min(low[x],low[v]);if(low[v] dfn[x] x ! f) //(5)如果该子节点不能到达祖先节点 (标记)cut[x] 1;if(x f)//每从根结点往孩子走就加1son;}low[x] min(low[x],dfn[v]);}if(x f son 2) //(6)根节点且孩子个数大于2即为割点cut[x] 1; } void add(int u,int v) {s[top].v v;s[top].next dp[u];dp[u] top; } void init() {memset(dp,-1,sizeof(dp));memset(cut,0,sizeof(cut));memset(dfn,0,sizeof(dfn));memset(low,0,sizeof(low));id ans top 0; } int main() {while(~scanf(%d,n) n){init();while(scanf(%d,a) a){char ch;while(scanf(%d%c,b,ch)){add(a,b),add(b,a);if(ch \n)break;}}for(int i 1; in; i){if(!dfn[i])tarjan(i,i);}for(int i 1; in; i){if(cut[i])ans;}printf(%d\n,ans);}return 0; }
http://www.huolong8.cn/news/75438/

相关文章:

  • 广州手机端网站制作列举免费域名注册的网站
  • 网站建设需要配置环境么网站建设服务商 需要什么主机
  • 淘宝客导购网站建设房地产公司网站建设方案
  • 温州手机网站制作磁力蜘蛛搜索引擎
  • wordpress未验证邮箱株洲网站seo优化价格
  • 专门做处理货的网站军事新闻最新消息今天
  • 电子商务网站后台核心管理网站网络优化外包
  • 淄博中企动力公司网站刚做的公司网站搜不到
  • 建设项目环境影响评价公示网站wordpress 本地视频插件
  • 如何用excel来做网站后台快速软件开发平台
  • 网站制作视频课程php7 mysql wordpress
  • 网站首页大图的尺寸asp 公司网站
  • 浙江省网站备案流程网页设计公司开设需要投资多少钱
  • 那个视频网站最好最全网址php做网站需要什么
  • 衡阳网站制作自适应网站建设选哪家
  • 镇江高端网站建设工作室太原网站上排名
  • 南京做网站优化哪家好表白网
  • 吉林市网站制作郑州市建网站
  • 精品课程网站建设内容惠州企业建站系统
  • 学网站建设难吗网页视频下载快捷指令库
  • 网站程序和数据库网站开发需求ppt
  • 建筑类企业网站模板下载品牌网站建设968
  • 什么是网站开发流程网站建设审批表
  • 购物网站建设论文姜堰区网站建设
  • 手机网站二级导航菜单教育企业网站源码
  • 蒙自做网站的公司湖南门户网站建设
  • 模板网站的优势有哪些昆山企业网站建设
  • 医疗手机网站开发免费注册个人邮箱申请
  • 深圳微信建网站未来做哪些网站致富
  • 太平洋建设集团网站php电影网站开发