当前位置: 首页 > 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.sadfv.cn/news/75438/

相关文章:

  • 网站备案类型网站互联
  • 网站制作 建站汽车网站开发思路
  • 上海网站建设在哪免费的网站建设
  • 多模块内容网页布局设计曲靖seo
  • 做网站 需求网页制作软件app免费
  • 别人公司网站进不去店面设计装修网
  • 网站开发有啥作用wordpress togetherjs
  • 自己做彩票网站江阴公司网站建设
  • 国外工业设计网站排名查询
  • 乌班图系统做网站西安电商网站开发
  • 网站的说服力移动互联网终端
  • 网站主页布局域名怎么建网站
  • 网站建设管理属于职业资格吗猫咪社区官网在线最新
  • 网站建设开发岗位职责如何登陆建设银行信用卡网站
  • 网站转应用环境设计
  • 做网站需要注意些什么国内知名软件开发公司
  • 网页制作实践 做网站莱芜网站建设哪家好
  • 常州市建设局网站淳安网站建设
  • 教育技术学网站模版如何做带后台的网站
  • 鄂州英文网站建设wordpress删除无分类文章
  • 营销型网站建设电话栾川网站建设
  • 360怎么做网站排名培训网站设计
  • 万域网站建设珠海企业医疗网站建设
  • 网站在百度上搜不到江苏做网站找谁
  • 网站建设二次开发ppt模板免费下载网址
  • 个人网站备案后做游戏网站开发网页设计
  • 企业邮箱收费吗seo 适合哪些行业
  • 网站建设公司果动房地产市场现状分析2022
  • 台州网站排名优化公司汇点远程app下载安装
  • 如何做网站的搜索栏高端网约车收入怎么样