F.A.Q
Hand In Hand
Online Acmers
Problem Archive
Realtime Judge Status
Authors Ranklist
 
     C/C++/Java Exams     
ACM Steps
Go to Job
Contest LiveCast
ICPC@China
Best Coder beta
VIP | STD Contests
    DIY | Web-DIY beta
Author ID 
Password 
 Register new ID

JZPTREE

Time 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
1 5 3 1 2 2 3 3 4 4 5
 

Sample Output
100 37 18 37 100
 

Hint

Thank oimaster for this problem :).
 

Author
WJMZBMR
 

Source
 

Statistic | Submit | Discuss | Note
Hangzhou Dianzi University Online Judge 3.0
Copyright © 2005-2024 HDU ACM Team. All Rights Reserved.
Designer & Developer : Wang Rongtao LinLe GaoJie GanLu
Total 0.000000(s) query 1, Server time : 2024-11-21 20:35:20, Gzip enabled