{"trustable":true,"prependHtml":"\u003cstyle type\u003d\"text/css\"\u003esection pre {\n display: block;\n padding: 9.5px;\n margin: 0 0 10px;\n font-size: 13px;\n line-height: 1.42857143;\n word-break: break-all;\n word-wrap: break-word;\n color: #333;\n background: rgba(255, 255, 255, 0.5);\n border: 1px solid #ccc;\n border-radius: 6px;\n}\u003c/style\u003e","sections":[{"title":"","value":{"format":"HTML","content":"\u003cdiv id\u003d\"problem-body\" class\u003d\"\"\u003e\n\t\t\t\u003cdiv class\u003d\"col-md-12\"\u003e\n\t\t\t\t\u003csection id\u003d\"description\" class\u003d\"problem-section\"\u003e\n\t\t\t\t\u003cdiv class\u003d\"headline\"\u003e\n\t\t\t\t\u003ch2\u003e题目描述\u003c/h2\u003e\n\t\t\t\t\u003c/div\u003e\n\t\t\t\t\u003cdiv id\u003d\"problem_description\" class\u003d\"problem-text\"\u003e\n\t\t\t\t\u003cp\u003e树的直径是指树中任意两点之间的最长距离。请编写一个程序来计算树的直径。\u003c/p\u003e\r\n\n\t\t\t\t\u003c/div\u003e\n\t\t\t\t\u003c/section\u003e\n\t\t\t\u003c/div\u003e\n\t\t\t\t\t\t\t\t\t\t\u003cdiv class\u003d\"col-md-12\"\u003e\n\t\t\t\t\t\u003csection id\u003d\"input\" class\u003d\"problem-section\"\u003e\n\t\t\t\t\t\u003cdiv class\u003d\"headline\"\u003e\n\t\t\t\t\t\u003ch2\u003e输入\u003c/h2\u003e\n\t\t\t\t\t\u003c/div\u003e\n\t\t\t\t\t\u003cdiv id\u003d\"problem_input\" class\u003d\"problem-text\"\u003e\n\t\t\t\t\t\u003cp\u003e输入包括树的信息。首先给出树的顶点数V (2 ≤ V ≤ 100,000),接下来的V行描述了每条边的信息。每行的格式如下:首先给出顶点编号,然后是与该顶点相连的另一个顶点的编号和它们之间的距离。例如,第四行表示顶点3与顶点1相连,距离为2;顶点3与顶点4相连,距离为3。每行的最后一个数为-1。给定距离均为不超过10,000的自然数。\u003c/p\u003e\r\n\n\t\t\t\t\t\u003c/div\u003e\n\t\t\t\t\t\u003c/section\u003e\n\t\t\t\t\u003c/div\u003e\n\t\n\t\t\t\t\u003cdiv class\u003d\"col-md-12\"\u003e\n\t\t\t\t\t\u003csection id\u003d\"output\" class\u003d\"problem-section\"\u003e\n\t\t\t\t\t\u003cdiv class\u003d\"headline\"\u003e\n\t\t\t\t\t\u003ch2\u003e输出\u003c/h2\u003e\n\t\t\t\t\t\u003c/div\u003e\n\t\t\t\t\t\u003cdiv id\u003d\"problem_output\" class\u003d\"problem-text\"\u003e\n\t\t\t\t\t\u003cp\u003e输出树的直径。\u003c/p\u003e\r\n\n\t\t\t\t\t\u003c/div\u003e\n\t\t\t\t\t\u003c/section\u003e\n\t\t\t\t\u003c/div\u003e\n\t\t\t\t\t\t\u003cdiv class\u003d\"col-md-12\"\u003e\n\t\t\t\u003csection id\u003d\"limit\" style\u003d\"display:none;\" class\u003d\"problem-section\"\u003e\n\t\t\t\u003cdiv class\u003d\"headline\"\u003e\n\t\t\t\u003ch2\u003e限制\u003c/h2\u003e\n\t\t\t\u003c/div\u003e\n\t\t\t\u003cdiv id\u003d\"problem_limit\" class\u003d\"problem-text\"\u003e\n\t\t\t\t\t\t\u003c/div\u003e\n\t\t\t\u003c/section\u003e\n\t\t\t\u003c/div\u003e\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\u003cdiv class\u003d\"col-md-12\"\u003e\n\t\t\t\t\u003cdiv class\u003d\"row\"\u003e\n\t\t\t\t\t\u003cdiv\u003e\u003ch2\u003e示例 1\u003c/h2\u003e\u003ctable class\u003d\"vjudge_sample\"\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\n1 3 2 -1\n2 4 4 -1\n3 1 2 4 3 -1\n4 2 4 3 3 5 6 -1\n5 4 6 -1\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e11\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n\u003c/div\u003e\n\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\u003c/div\u003e\n\t\t\t\t\u003c/div\u003e\n\t\t\t\t\t\t\t\t\t\t\u003cdiv class\u003d\"col-md-12\"\u003e\n\t\t\t\t\u003csection id\u003d\"hint\" style\u003d\"display: none;\" class\u003d\"problem-section\"\u003e\n\t\t\t\t\u003cdiv class\u003d\"headline\"\u003e\n\t\t\t\t\u003ch2\u003e提示\u003c/h2\u003e\n\t\t\t\t\u003c/div\u003e\n\t\t\t\t\u003cdiv id\u003d\"problem_hint\" class\u003d\"problem-text\"\u003e\n\t\t\t\t\n\t\t\t\t\u003c/div\u003e\n\t\t\t\t\u003c/section\u003e\n\t\t\t\u003c/div\u003e\n\t\t\t\t\t\t\t\t\u003c/div\u003e"}}]}