func_code_string: #include <bits/stdc++.h>   using namespace std;   const int maxn = 2e5 + 10;   const long long mod = 1e9 + 7;   struct node {     int s, e, next;   } edge[maxn];   int head[maxn], len;   void add(int s, int e) {     edge[len].e = e;     edge[len].next = head[s];     head[s] = len++;   }   void init() {     memset(head, -1, sizeof(head));     len = 0;   }   double dp[maxn];   void dfs(int x, int fa) {     dp[x] = 0;     int ans = 0;     for (int i = head[x]; i != -1; i = edge[i].next) {       int y = edge[i].e;       if (y == fa) continue;       dfs(y, x);       dp[x] += dp[y];       ans++;     }     if (ans == 0)       dp[x] = 0;     else       dp[x] = dp[x] / ans + 1;   }   int main() {     int n;     while (scanf( %d , &n) != EOF) {       init();       int x, y;       for (int i = 1; i < n; i++) {         scanf( %d%d , &x, &y);         add(x, y);         add(y, x);       }       dfs(1, -1);       printf( %.8f n , dp[1]);     }   }   