hdu 3069

Arrest

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 194    Accepted Submission(s): 80

Problem Description
Country ALPC has n cities, and the cities are connected by undirected roads. Furthermore, there is exactly one route between each pair of cities. Now some criminals break the prison and the police do not know where they are. And the criminals can stay in a city or move on the roads. The police office has made a decision to send policemen to arrest the breakers. If a police and a criminal at a same point at the same time the criminal is under arrest, no matter in a city or on a road. The police office wants to minimize the number of policemen to arrest all the criminals. Now the map of Country ALPC is given, please tell the police office the least number of policemen required.
 

 

Input
There are several test cases.
The first line a integer n, the number of cities. Next n-1 lines each two integers a and b, there is a road between city a and city b.
(1<=n <= 1000, 1 <= a, b <= n)
 

 

Output
For each case output the minimal number of policemen.
 

 

Sample Input
  
  
3 1 2 2 3 16 1 2 1 3 1 4 5 6 5 7 10 8 8 11 9 12 9 13 14 1 14 15 15 16 15 8 9 16 14 5
 

 

Sample Output
  
  
1 3
 

 

Source
 
设n为一个节点需要警察的数量;
若一个节点的子节点最大值n只有一个,则父节点的n=它孩子的最大值n
else parent's n=最大值+1
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值