Logo
(追記) (追記ここまで)

32664번 - Cascade Centrality 스페셜 저지다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 (추가 시간 없음) 1024 MB76685.714%

문제

Given an undirected graph $G=(V,E),ドル the cascade centrality of node $i$ in $V$ is defined to be: $1ドル + \sum_{j \in V \setminus \{i\}} \sum_{P \in P_{ij}} \frac{1}{\chi_P},$$ where $P_{ij}$ is the set of all simple paths from node $i$ to node $j,ドル and the degree sequence product $\chi_P$ 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, $G$ is a tree, so that $P_{ij}$ always contains exactly one path. Find the mean of the cascade centralities of the nodes in $G$.

입력

The first line of input consists of an integer $N$ $(1 \leq N \leq 100),ドル the number of nodes in the tree.

The remaining $N-1$ lines each contains two space-separated integers $u_i$ and $v_i$ $(1 \leq u_i, v_i \leq N),ドル denoting an undirected edge from node $u_i$ to node $v_i$. 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 10ドル^{-6}$ relative or absolute error.

제한

예제 입력 1

1

예제 출력 1

1.000000

예제 입력 2

2
1 2

예제 출력 2

2.000000

예제 입력 3

3
1 3
3 2

예제 출력 3

2.333333

힌트

출처

ICPC > Regionals > North America > Mid-Central Regional > 2024 Mid-Central USA Programming Contest D번

  • 문제를 만든 사람: Christian Yongwhan Lim
(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /