report VI VI EN
Register | Login
  • HOME
  • PROBLEMSET
  • ROADMAP
  • COMPETITION
  • TOPIC
  • RANKING
  • GUIDE
  • MASHUP
  • ABOUT
  • CONTACT
  • Problem
  • Submit
  • Results
Leaves - FlandreOJ: Flandre Online Judge

Leaves

Time limit: 1000 ms
Memory limit: 256 MB
Given a tree of $n$ vertices. You can choose the root arbitrarily, find the maximum number of leaves in the tree. ### Input - The first line contains an integers $n$. - The next $n - 1$ lines, each line contains two integers $u,v$, there is an edge between $u$ and $v$. ### Output - Print the maximum number of leaves. ### Constraints - $1 \le n \le 10^5$. - $1 \le u, v \le n$. ### Example Input: ``` 3 1 2 1 3 ``` Output: ``` 2 ```
Introduction to tree
Tree
Leaves
Depth
Subtree size
Jogging
Tree diameter
White path
Topic
Tree
Rating 800
Solution (1) Solution