Codeforces Round 1133 (Div. 1, Div. 2) is coming soon! Register here. ×

Given an undirected tree, count how many pathsThe number of path in tree that have at least length of k.
Difference between en1 and en2, changed 111 character(s)
#### Statement↵
↵
Given an undirected tree, count how many paths that have at least length of k.↵
↵
#### Input↵
↵
The first line is n (n <= 10 ^ 5) and k (k <= n) &mdash; the number of vertices and k as mentioned above.↵
↵
Next n &mdash; 1 line represents an edge.↵
↵
5 2↵
↵
1 2↵
↵
2 3 ↵
↵
2 4↵
↵
4 5↵
↵
#### Output↵
↵
6↵
↵
#### Explain↵
↵
All paths that have at least length of k: ↵
↵
(1,3)
; (1,4); (1,5);: 1-2-3↵
↵
(1,4): 1-2-4↵
↵
(1,5): 1-2-4-5
↵
↵
(2,5)
;: 2-4-5↵
↵
(3,4)
; (3,5);: 3-2-4 ↵
↵
(3,5): 3-2-4-5
↵

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en2 English EonHino 2018-11-21 19:09:25 111
en1 English EonHino 2018-11-21 14:16:38 511 Initial revision (published)