func_code_string: #include <bits/stdc++.h>   using namespace std;   struct Edge {     int from, to;     Edge(int f, int t) : from(f), to(t) {}   };   vector<Edge> edges;   vector<int> G[100005];   int h[100005];   void add_edge(int from, int to) {     edges.push_back(Edge(from, to));     int m = edges.size();     G[from].push_back(m - 1);     return;   }   void bfs(int x) {     queue<int> Q;     Q.push(x);     int cnt = 1, first = 1;     h[x] = cnt;     while (!Q.empty()) {       int u = Q.front();       Q.pop();       if (h[u] == cnt && first) {         cnt++;         first = 0;       }       for (int i = 0; i < G[u].size(); i++) {         Edge &e = edges[G[u][i]];         if (!h[e.to]) {           h[e.to] = cnt;           Q.push(e.to);         }       }       first = 1;     }   }   int main() {     int n;     while (scanf( %d , &n) != EOF) {       for (int i = 0; i < n - 1; i++) {         int u, v;         scanf( %d %d , &u, &v);         add_edge(u, v);         add_edge(v, u);       }       memset(h, 0, sizeof(h));       bfs(1);       double sum = 0.0;       for (int i = 1; i <= n; i++) {         if (h[i] != 0) sum += (double)1 / h[i];       }       printf( %lf n , sum);     }     return 0;   }   