#P3469. [POI2008] BLO-Blockade
[POI2008] BLO-Blockade
题目描述
There are exactly towns in Byteotia.
Some towns are connected by bidirectional roads.
There are no crossroads outside towns, though there may be bridges, tunnels and flyovers. Each pair of towns may be connected by at most one direct road. One can get from any town to any other-directly or indirectly.
Each town has exactly one citizen.
For that reason the citizens suffer from loneliness.
It turns out that each citizen would like to pay a visit to every other citizen (in his host's hometown), and do it exactly once. So exactly visits should take place.
That's right, should.
Unfortunately, a general strike of programmers, who demand an emergency purchase of software, is under way.
As an act of protest, the programmers plan to block one town of Byteotia, preventing entering it, leaving it, and even passing through.
As we speak, they are debating which town to choose so that the consequences are most severe.
Task Write a programme that:
reads the Byteotian road system's description from the standard input, for each town determines, how many visits could take place if this town were not blocked by programmers, writes out the outcome to the standard output.
输入格式
In the first line of the standard input there are two positive integers: and (, ) denoting the number of towns and roads, respectively.
The towns are numbered from 1 to .
The following lines contain descriptions of the roads.
Each line contains two integers and () and denotes a direct road between towns numbered and .
输出格式
Your programme should write out exactly integers to the standard output, one number per line. The line should contain the number of visits that could not take place if the programmers blocked the town no. .
题目大意
B 城有 个城镇(从 到 标号)和 条双向道路。
每条道路连结两个不同的城镇,没有重复的道路,所有城镇连通。
把城镇看作节点,把道路看作边,容易发现,整个城市构成了一个无向图。
请你对于每个节点 求出,把与节点 关联的所有边去掉以后(不去掉节点 本身),无向图有多少个有序点 ,满足 和 不连通。
【输入格式】
第一行包含两个整数 和 。
接下来 行,每行包含两个整数 和 ,表示城镇 和 之间存在一条道路。
【输出格式】
输出共 行,每行输出一个整数。
第 行输出的整数表示把与节点 关联的所有边去掉以后(不去掉节点 本身),无向图有多少个有序点 ,满足 和 不连通。
【数据范围】
,。
5 5
1 2
2 3
1 3
3 4
4 5
8
8
16
14
8