constint maxn=100005;typedefstruct{int l,r,sums;}node;
node tree[maxn];inlinevoidbuild(int i,int l,int r)// build the section tree;{
tree[i].l=l,tree[i].r=r;if(l==r)//tree[i] is the root node{
tree[i].sums=input[l];return;}int mid=(l+r)>>1;build(2*i,l,mid);//build the left child treebuild(2*i+1,mid+1,r);//build the right child tree
tree[i].sums=tree[2*i].sums+tree[2*i+1].sums;}
16.线段树1.建树const int maxn=100005;typedef struct{ int l,r,sums;}node;node tree[maxn];inline void build(int i,int l,int r)// build the section tree;{ tree[i].l=l,tree[i].r=r; if(l==r)//tree[i] is the root node { tree[i].sums=in