func_code_string: #include <bits/stdc++.h>   using namespace std;   vector<vector<int> > g;   vector<long double> ans;   vector<int> sum;   void dfs0(int x) {     sum[x] = 1;     for (int to : g[x]) {       dfs0(to);       sum[x] += sum[to];     }   }   void dfs(int x, long double f) {     ans[x] = f;     int s = sum[x] - 1;     for (int to : g[x]) {       dfs(to, ((s - sum[to]) / 2.0) + f + 1.0);     }   }   int main() {     ios_base::sync_with_stdio(0);     int n;     cin >> n;     g.resize(n);     ans.resize(n);     sum.resize(n);     for (int i = 1; i < n; i++) {       int p;       cin >> p;       p--;       g[p].push_back(i);     }     dfs0(0);     dfs(0, 1.0);     cout << fixed << setprecision(8);     for (long double x : ans) cout << x <<    ;     return 0;   }   