func_code_string: #include <bits/stdc++.h>   using namespace std;   int n, head[100000 + 5], sz[100000 + 5], cnt = 1;   double ans[100000 + 5];   struct edges {     int to, next;   } e[2 * 100000 + 5];   inline void insert(int x) {     int u = x, v;     scanf( %d , &v);     e[++cnt] = (edges){u, head[v]};     head[v] = cnt;     e[++cnt] = (edges){v, head[u]};     head[u] = cnt;   }   void dfs(int x, int fa) {     sz[x] = 1;     for (int i = head[x]; i; i = e[i].next) {       if (e[i].to == fa) continue;       dfs(e[i].to, x);       sz[x] += sz[e[i].to];     }   }   void dfs1(int x, int fa) {     for (int i = head[x]; i; i = e[i].next) {       if (e[i].to == fa) continue;       ans[e[i].to] = 1.0 * (sz[x] - 1 - sz[e[i].to]) / 2.0 + 1.0 + ans[x];       dfs1(e[i].to, x);     }   }   int main() {     scanf( %d , &n);     for (int i = 2; i <= n; i++) insert(i);     dfs(1, 0);     ans[1] = 1;     dfs1(1, 0);     for (int i = 1; i <= n; i++) printf( %.7lf n , ans[i]);     return 0;   }   