{"trustable":true,"prependHtml":"\u003cscript\u003e window.katexOptions \u003d { disable: true }; \u003c/script\u003e\n\u003cscript type\u003d\"text/x-mathjax-config\"\u003e\n MathJax.Hub.Config({\n tex2jax: {\n inlineMath: [[\u0027$$$\u0027,\u0027$$$\u0027], [\u0027$\u0027,\u0027$\u0027]],\n displayMath: [[\u0027$$$$$$\u0027,\u0027$$$$$$\u0027], [\u0027$$\u0027,\u0027$$\u0027]]\n }\n });\n\u003c/script\u003e\n\u003cscript async src\u003d\"https://mathjax.codeforces.org/MathJax.js?config\u003dTeX-AMS-MML_HTMLorMML\" type\u003d\"text/javascript\"\u003e\u003c/script\u003e","sections":[{"title":"说明","value":{"format":"HTML","content":"\u003cdiv class\u003d\"panel_content\"\u003e\n 这里有一棵树,有一种生活。你能解决这个关于树的问题吗?\n \u003cbr\u003e\n 我们有一棵有n个顶点的树。\n \u003cbr\u003e\n 我们定义dist(u, v)为从u到v的路径上的边数。\n \u003cbr\u003e\n 对于每个顶点u,定义E\u003csub\u003eu\u003c/sub\u003e \u003d\u003cimg style\u003d\"max-width:100%;\" src\u003d\"CDN_BASE_URL/cadb02c2b1cb2847dec9865c0f9ed175?v\u003d1694286127\"\u003e\n \u003cbr\u003e\n 给定树和k。\n \u003cbr\u003e\n 打印出每个顶点的E\u003csub\u003ei\u003c/sub\u003e(从1到n)。(方便起见,对10007取模)。\n\u003c/div\u003e"}},{"title":"输入","value":{"format":"HTML","content":"第一行包含整数T(1 ≤ T ≤ 5),表示测试用例的数量。\n\u003cbr\u003e\n对于每个测试用例,第一行包含两个整数n,k(1 ≤ n ≤ 50000,1 ≤ k ≤ 500)。\n\u003cbr\u003e\n然后是接下来的n-1行,每行包含两个整数a,b(1 ≤ a,b ≤ n),表示a和b之间有一条边。"}},{"title":"输出","value":{"format":"HTML","content":"对于每个测试用例,打印出n行,第i行包含E\u003csub\u003ei\u003c/sub\u003e。"}},{"title":"示例","value":{"format":"HTML","content":"\u003ctable class\u003d\u0027vjudge_sample\u0027\u003e\n\u003cthead\u003e\n \u003ctr\u003e\n \u003cth\u003e输入\u003c/th\u003e\n \u003cth\u003e输出\u003c/th\u003e\n \u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n \u003ctr\u003e\n \u003ctd\u003e\u003cpre\u003e1\r\n5 3\r\n1 2\r\n2 3\r\n3 4\r\n4 5\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e100\r\n37\r\n18\r\n37\r\n100\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e"}},{"title":"提示","value":{"format":"HTML","content":"\u003cbr\u003e\n感谢oimaster提供这个问题:)。"}}]}