func_code_string: #include <bits/stdc++.h>   using namespace std;   const int MX = 1e5 + 5;   struct Edge {     int v, nxt;   } E[MX * 2];   int Head[MX], erear;   void edge_init() {     erear = 0;     memset(Head, -1, sizeof(Head));   }   void edge_add(int u, int v) {     E[erear].v = v;     E[erear].nxt = Head[u];     Head[u] = erear++;   }   int siz[MX];   double ans[MX];   void DFS1(int u, int f) {     siz[u] = 1;     for (int i = Head[u]; ~i; i = E[i].nxt) {       int v = E[i].v;       if (v == f) continue;       DFS1(v, u);       siz[u] += siz[v];     }   }   void DFS2(int u, int f) {     for (int i = Head[u]; ~i; i = E[i].nxt) {       int v = E[i].v;       if (v == f) continue;       ans[v] = ans[u] + 1 + (siz[u] - siz[v] - 1) / 2.0;       DFS2(v, u);     }   }   int main() {     int n;     edge_init();     scanf( %d , &n);     for (int i = 2; i <= n; i++) {       int t;       scanf( %d , &t);       edge_add(i, t);       edge_add(t, i);     }     ans[1] = 1;     DFS1(1, -1);     DFS2(1, -1);     for (int i = 1; i <= n; i++) {       printf( %.8lf%c , ans[i], i == n ?   n  :    );     }     return 0;   }   