====== 스크루지 민호 ====== ===== 풀이 ===== * [[ps:트리의 지름#트리의 중심과 반지름을 구하기|트리의 반지름]] 을 구하는 기본적인 문제. 링크에서 설명하는 알고리즘을 그대로 적용하면 된다. 시간복잡도는 O(n) ===== 코드 ===== """Solution code for "BOJ 12896. 스크루지 민호". - Problem link: https://www.acmicpc.net/problem/12896 - Solution link: http://www.teferi.net/ps/problems/boj/12896 Tags: [tree diameter] """ from teflib import tree as ttree def main(): _, tree = ttree.create_tree_from_input() print(ttree.DistanceMeasures(tree).radius) if __name__ == '__main__': main() * Dependency: [[:ps:teflib:tree#DistanceMeasures|teflib.tree.DistanceMeasures]] {{tag>BOJ ps:problems:boj:골드_2}}