|
||||||||||
JZPTREETime Limit: 20000/10000 MS (Java/Others) Memory Limit: 655360/655360 K (Java/Others)Total Submission(s): 627 Accepted Submission(s): 288 Problem Description There is a tree,there is a life.Can you solve this problem about tree? Here we have a tree which has n vertices. We define dist(u, v) as the number of edges on the path from u to v. And for each vertices u , define Eu = Give you the tree and k. Print Ei for every vertices(from 1 to n).(mod 10007 for convenience). Input The first line contains integer T(1 T 5),denote the number of the test cases. For each test cases,the first line contains two integers n,k(1<=n<=50000, 1<=k<=500). Then next n-1 lines,each lines contains two integer a,b(1<=a, b<=n),denote there is an edge between a, b. Output For each test cases,print n lines,the i-th line contains Ei. Sample Input
Sample Output
Hint Thank oimaster for this problem :). Author WJMZBMR Source | ||||||||||
|