???+note "参考代码"
```cpp
// 这份代码默认节点编号从 1 开始,即 i ∈ [1,n]
- int size[MAXN], // 这个节点的“大小”(所有子树上节点数 + 该节点)
+ int size[MAXN], // 这个节点的“大小”(所有子树上节点数 + 该节点)
weight[MAXN], // 这个节点的“重量”
centroid[2]; // 用于记录树的重心(存的是节点编号)
void GetCentroid(int cur, int fa) { // cur 表示当前节点 (current)
## 习题
- [POJ 1655 Balancing Art](http://poj.org/problem?id=1655) (模板题)
-- [CodeForces 1406 C Link Cut Centroids](https://codeforces.com/contest/1406/problem/C)
+- [CodeForces 1406 C Link Cut Centroids](https://codeforces.com/contest/1406/problem/C)