func_code_string: #include <bits/stdc++.h>   using namespace std;   const int maxn = 1e5 + 100;   vector<int> v[maxn];   int childsNo[maxn];   double expected_finish_time[maxn];   void dfs_calc_number_of_childs(int vert, int par) {     for (int i = 0; i < v[vert].size(); i++) {       int child = v[vert][i];       if (child != par) {         dfs_calc_number_of_childs(child, vert);         childsNo[vert] += childsNo[child];       }     }     childsNo[vert] += 1;   }   void dfs_calc_expected_finish_time(int vert, int par) {     for (int i = 0; i < v[vert].size(); i++) {       int child = v[vert][i];       if (child != par) {         expected_finish_time[child] =             expected_finish_time[vert] + 1 +             (childsNo[vert] - childsNo[child] - 1) / 2.0;         dfs_calc_expected_finish_time(child, vert);       }     }   }   int main() {     int n;     cin >> n;     for (int i = 2; i <= n; i++) {       int p;       cin >> p;       v[p].push_back(i);       v[i].push_back(p);     }     dfs_calc_number_of_childs(1, -1);     expected_finish_time[1] = 1;     dfs_calc_expected_finish_time(1, -1);     for (int i = 1; i <= n; i++) cout << expected_finish_time[i] <<    ;     cout << endl;     return 0;   }   