func_code_string: #include <bits/stdc++.h>   using namespace std;   const int N = 100010;   long long int A[N];   vector<int> g[N];   long long int dfs(int x, int p) {     A[x] = 1;     for (int i = 0; i < g[x].size(); ++i) {       int y = g[x][i];       if (y == p) continue;       A[x] += dfs(y, x);     }     return A[x];   }   long double E[N];   void solve(int x, int p) {     long long int n = (long long int)g[x].size();     for (int i = 0; i < g[x].size(); ++i) {       int y = g[x][i];       if (y == p) continue;       E[y] = E[x] + 1;       long double med = (A[x] - 1 - A[y]) / (long double)(n - 1);       if (g[x].size() != 1) {         E[y] += (med * (n - 1)) / (2.0);       }       solve(y, x);     }   }   int main(void) {     ios::sync_with_stdio(false);     int n;     cin >> n;     for (int i = 2; i <= n; ++i) {       int x;       cin >> x;       g[x].push_back(i);       g[i].push_back(x);     }     E[1] = 1.0;     dfs(1, -1);     solve(1, -1);     cout.precision(10);     for (int i = 1; i <= n; ++i) {       cout << fixed << E[i] <<    ;     }     cout << endl;   }   