程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
 程式師世界 >> 編程語言 >> 更多編程語言 >> 編程解疑 >> each-Tour in Wonder Land

each-Tour in Wonder Land

編輯:編程解疑
Tour in Wonder Land

Description

You must have heard of the literature "Alice's Adventures in Wonderland"! The 3D film "Alice in Wonderland" published by Disney Company becomes the most popular film in 2010! Today, Alice starts her new adventure in Wonderland again!

In Wonderland, there are n cities, numbered from 1 to n. The capital is city 1. Cities are connected by bi-directional roads. The road system is constructed so that from every city, there is exactly one way to reach any other.

Alice hopes that she could make a tour in which she visits each city exactly once then return to the capital. Furthermore, she doesn't want to traverse any road more than once. Obviously, it is impossible to make such tour with current road system.

However, in Wonderland, we can use magic spells! The Cheshire Cat, with his magic power, plans to construct more roads to make Alice's dream come true. Sadly, if he used too many magic spells, he would be weaken. "What is the minimum number of roads I have to construct?" - The poor cat wonders. Could you help him answer this question?

Input

The first line of input contains the number n --- the number of cities in Wonderland (3 ≤ n ≤ 100 000). The following n-1 lines describe the roads. Each road is represented by two integers --- the indexes of two cities it connects.

Output

The minimum number of roads to construct.

Sample Input

5
1 2
2 3
2 4
1 5
Sample Output

2

最佳回答:


http://www.th7.cn/Program/java/201603/777295.shtml

  1. 上一頁:
  2. 下一頁:
Copyright © 程式師世界 All Rights Reserved