经典指数          
POJ
原因
914
浏览数
0
收藏数
 

Consider a tree T with N (1 For example, consider the tree:

Deleting node 4 yields two trees whose member nodes are {5} and {1,2,3,6,7}. The larger of these two trees has five nodes, thus the balance of node 4 is five. Deleting node 1 yields a forest of three trees of equal size: {2,6}, {3,7}, and {4,5}. Each of these trees has two nodes, so the balance of node 1 is two. For each input tree, calculate the node that has the minimum balance. If multiple nodes have equal balance, output the one with the lowest number. 输入描述 The first line of input contains a single intege输出描述 For each test case, print a line containing two integers, the number of the node with minimum balance and the balance of that node.输入例子 1 7 2 6 1 2 1 4 4 5 3 7 3 1 输出例子 1 2

     举报   纠错  
 
切换
暂时还没有答案,欢迎分享你的解答 . . .
撰写答案
扫描后移动端查看本题