Loading [MathJax]/jax/output/CommonHTML/jax.js
Path with length k - MarisaOJ: Marisa Online Judge

Path with length k

Time limit: 1000 ms
Memory limit: 256 MB
Given a tree of n vertices. Count the number of simple paths with length k. ### Input - The first line contains an integer n. - The next n−1 lines, each line contains 2 integers u,v, there is an edge between u and v. ### Output - Print the number of paths with length k. ### Constraints - 1≤n≤105. - 1≤k≤100. - 1≤u,v≤n. ### Example Input: 5212231445 Output: 3