PAT Battle Over Cities [未作]
1013 Battle Over Cities (25)(25 分)
It is vitally important to have all the cities connected by highways in a war. If a city is occupied by the enemy, all the highways from/toward that city are closed. We must know immediately if we need to repair any other highways to keep the rest of the cities connected. Given the map of cities which have all the remaining highways marked, you are supposed to tell the number of highways need to be repaired, quickly.
For example, if we have 3 cities and 2 highways connecting city~1~-city~2~ and city~1~-city~3~. Then if city~1~ is occupied by the enemy, we must have 1 highway repaired, that is the highway city~2~-city~3~.
Input
Each input file contains one test case. Each case starts with a line containing 3 numbers N (<1000), M and K, which are the total number of cities, the number of remaining highways, and the number of cities to be checked, respectively. Then M lines follow, each describes a highway by 2 integers, which are the numbers of the cities the highway connects. The cities are numbered from 1 to N. Finally there is a line containing K numbers, which represent the cities we concern.
Output
For each of the K cities, output in a line the number of highways need to be repaired if that city is lost.
Sample Input
3 2 3
1 2
1 3
1 2 3
Sample Output
1
0
0
//这个题目的大意就是在一个图中,如果去掉一个点和它所连的边,查看会出现几个连通分量。
PAT Battle Over Cities [未作]的更多相关文章
- PAT The Best Rank[未作]
1012 The Best Rank (25)(25 分) To evaluate the performance of our first year CS majored students, we ...
- 图论 - PAT甲级 1013 Battle Over Cities C++
PAT甲级 1013 Battle Over Cities C++ It is vitally important to have all the cities connected by highwa ...
- PAT甲级1013. Battle Over Cities
PAT甲级1013. Battle Over Cities 题意: 将所有城市连接起来的公路在战争中是非常重要的.如果一个城市被敌人占领,所有从这个城市的高速公路都是关闭的.我们必须立即知道,如果我们 ...
- PAT 解题报告 1013. Battle Over Cities (25)
1013. Battle Over Cities (25) t is vitally important to have all the cities connected by highways in ...
- PAT 1013 Battle Over Cities
1013 Battle Over Cities (25 分) It is vitally important to have all the cities connected by highway ...
- PAT 1013 Battle Over Cities(并查集)
1013. Battle Over Cities (25) 时间限制 400 ms 内存限制 65536 kB 代码长度限制 16000 B 判题程序 Standard 作者 CHEN, Yue It ...
- pat 1013 Battle Over Cities(25 分) (并查集)
1013 Battle Over Cities(25 分) It is vitally important to have all the cities connected by highways i ...
- PAT 甲级 1013 Battle Over Cities (25 分)(图的遍历,统计强连通分量个数,bfs,一遍就ac啦)
1013 Battle Over Cities (25 分) It is vitally important to have all the cities connected by highway ...
- PAT_A1013#Battle Over Cities
Source: PAT A1013 Battle Over Cities (25 分) Description: It is vitally important to have all the cit ...
随机推荐
- JSON类库 Flexjson学习
官方地址(需FQ):http://flexjson.sourceforge.net/ Flexjson 是一个将 Java 对象转成 JSON 的 类库,是一个深度转换的过程. 下面是我写的一个例子: ...
- sencha touch 在线实战培训 第一期 第一节
经过忙碌的准备,终于在2013.12.28晚上8点开了第一节课. 第一次讲课有些小紧张,讲的内容也比较基础,不过算是开了一个好头. 本期培训一共八节,前三堂免费,后面的课程需要付费才可以观看. 本节内 ...
- 【黑金原创教程】【FPGA那些事儿-驱动篇I 】实验九:PS/2模块③ — 键盘与多组合键
实验九:PS/2模块③ — 键盘与多组合键 笔者曾经说过,通码除了单字节以外,也有双字节通码,而且双字节通码都是 8’hE0开头,别名又是 E0按键.常见的的E0按键有,<↑>,<↓ ...
- 【咸鱼教程】JsZip压缩与解压教程
引擎版本3.0.6 教程目录一 为什么要用jszip二 如何使用jszip 2.1 下载jszip库 2.2 导入jszip库 2.3 加载和解压zip代码三 Demo源码下载 一 ...
- 23种设计模式之抽象工厂(Abstract Factory)
抽象工厂模式又称为Kit模式,属于对象创建型模式.抽象工厂模式是所有形式的工厂模式中最为抽象和最具一般性的一种形态,它提供了一个创建一系列相关或相互依赖对象的接口,而无需指定它们具体的类.在抽象工厂模 ...
- Transient修饰符的使用
如果一个类没有继承Serilizable接口,那么它就不能被序列化,写入文件的时候会报异常.如果一个类继承了Serilizable接口,那么这个类的所有属性和方法都可以自动被序列化,而现实中我们又希望 ...
- MatLab Mark Points 给点标序号
在MatLab中,我们有时要给画出的点按一定顺序标上序号,下面这个简单的例子实现这个功能: x=rand(,); y=rand(,); plot(x,y,'r*'); text(x+:));
- GlusterFS实战
预装glusterfs软件包 yum -y install centos-release-gluster37.noarch yum --enablerepo=centos-gluster*-test ...
- jquery 1.9 1.8 判断 浏览器(IE11,IE8,IE7,IE6)版本
1.9以后很我方法删除了,所有和之前版本判断浏览器版本有所差记录一下 1.9 ------------------------------------------------------------- ...
- TOP100summit:【分享实录】链家网大数据平台体系构建历程
本篇文章内容来自2016年TOP100summit 链家网大数据部资深研发架构师李小龙的案例分享. 编辑:Cynthia 李小龙:链家网大数据部资深研发架构师,负责大数据工具平台化相关的工作.专注于数 ...