Loading [MathJax]/jax/output/HTML-CSS/jax.js
Login
Register
Universal Online Judge
UOJ
UOJ
Contests
Problems
Submissions
Hack!
Blogs
Help
时间限制:1 s
空间限制:512 MB
Good
Bad
[
-1
]
#2197. 树上最长链
Statistics
Statement
Submit
Custom Test
给定一棵树,求出树上最长的链,边长都为1。
输入格式:第一行一个数
n
≤
10
5
表示节点数,接下来
n
−
1
行每行两个数表示树上一条边的两个端点。
样例:
5 1 2 2 3 3 4 2 5
3
Source code:answer
Language
C
C++
C++11
Java8
Java11
Pascal
Python2
Python3
Upload by editor
Upload from local
use advanced editor
Browse
Submit
Source code:answer
Language
C
C++
C++11
Java8
Java11
Pascal
Python2
Python3
Upload by editor
Upload from local
use advanced editor
Browse
Text file:input.txt
Upload by editor
Upload from local
use advanced editor
Browse
Run