Cascade Centrality
시간 제한1초메모리 제한1024 MB
트리가 주어질 때, 모든 단순 경로에서 각 노드의 차수 곱의 역수를 더한 중심성 값의 평균을 구한다.
문제
Given an undirected graph , the cascade centrality of node in is defined to be: where is the set of all simple paths from node to node , and the degree sequence product of a path is the product of the degrees of all nodes along the path, including the ending node but excluding the starting node.
In this problem, is a tree, so that always contains exactly one path. Find the mean of the cascade centralities of the nodes in .
입력
The first line of input consists of an integer , the number of nodes in the tree.
The remaining lines each contains two space-separated integers and , denoting an undirected edge from node to node . No edge connects a node to itself, and there is at most one edge between any pair of nodes.
The given graph is a tree: it is connected and does not contain a cycle.
출력
Print the mean of the cascade centralities of the nodes in the input graph. Your solution will be judged correct if it differs from the judge solution by at most relative or absolute error.