{"trustable":true,"sections":[{"title":"","value":{"format":"HTML","content":"Give a tree with n vertices,each edge has a length(positive integer less than 1001).\r\u003cbr\u003eDefine dist(u,v)\u003dThe min distance between node u and v.\r\u003cbr\u003eGive an integer k,for every pair (u,v) of vertices is called valid if and only if dist(u,v) not exceed k.\r\u003cbr\u003eWrite a program that will count how many pairs which are valid for a given tree. \r\u003cbr\u003e"}},{"title":"Input","value":{"format":"HTML","content":"The input contains several test cases. The first line of each test case contains two integers n, k. (n\u0026lt;\u003d10000) The following n-1 lines each contains three integers u,v,l, which means there is an edge between node u and v of length l.\r\u003cbr\u003eThe last test case is followed by two zeros.\r\u003cbr\u003e"}},{"title":"Output","value":{"format":"HTML","content":"For each test case output the answer on a single line."}},{"title":"Sample","value":{"format":"HTML","content":"\u003ctable class\u003d\u0027vjudge_sample\u0027\u003e\n\u003cthead\u003e\n \u003ctr\u003e\n \u003cth\u003eInput\u003c/th\u003e\n \u003cth\u003eOutput\u003c/th\u003e\n \u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n \u003ctr\u003e\n \u003ctd\u003e\u003cpre\u003e5 4\r\n1 2 3\r\n1 3 1\r\n1 4 2\r\n3 5 1\r\n0 0\r\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e8\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}}]}