func_code_string: #include <bits/stdc++.h>   using namespace std;   const int NMax = 100005;   vector<int> G[NMax];   long double Array[NMax];   int DP[NMax], N;   void Read() {     cin >> N;     for (int i = 1; i < N; i++) {       int x;       cin >> x;       G[x].push_back(i + 1);     }   }   void buildDP(int node) {     DP[node] = 1;     for (int i = 0; i < G[node].size(); i++) {       int neighb = G[node][i];       buildDP(neighb);       DP[node] += DP[neighb];     }   }   void DFS(int node) {     int sz = G[node].size();     for (int i = 0; i < G[node].size(); i++) {       int neighb = G[node][i];       Array[neighb] =           Array[node] + 0.5 * ((long double)DP[node] - 1.0 - DP[neighb]) + 1.0;       DFS(neighb);     }   }   void Print() {     for (int i = 1; i <= N; i++)       cout << fixed << setprecision(2) << Array[i] <<    ;     cout <<   n ;   }   int main() {     Read();     buildDP(1);     Array[1] = 1.0;     DFS(1);     Print();     return 0;   }   