摘要: http://poj.org/problem?id=3321思路:将树形结构转为线性结构,用线段树统计苹果数。包含了线段树的两个基本操作。单点更新 区间查询。通过这道题掌握了将树形结构转为线性结构的方法。AC Code 1 #include <cstdio> 2 #include <cstring> 3 #include <algorithm> 4 using namespace std; 5 #define lson l,m,rt<<1 6 #define rson m+1,r,rt<<1|1 7 #define maxn 1000 阅读全文