func_code_string: #include <bits/stdc++.h>   using namespace std;   vector<int> adj[100005];   int n;   long long sz[100005];   long double E[100005];   void dfs1(int u, int p) {     sz[u] = 1;     for (auto v : adj[u]) {       if (v == p) continue;       dfs1(v, u);       sz[u] += sz[v];     }   }   void dfs2(int u, int p) {     if (u) {       E[u] = E[p] + 1 + 1.0 * (sz[p] - sz[u] - 1) / 2.0;     } else       E[u] = 1;     for (auto v : adj[u]) {       dfs2(v, u);     }   }   int main() {     ios_base::sync_with_stdio(false), cin.tie(NULL);     ;     cin >> n;     for (int i = 1; i < n; i++) {       int p;       cin >> p;       p--;       adj[p].push_back(i);     }     dfs1(0, -1);     dfs2(0, -1);     cout << fixed << setprecision(7);     for (int i = 0; i < n; i++) {       cout << E[i];       if (i < n) cout <<    ;     }     cout << endl;     return 0;   }   