多说几句话,省的摘要里都是没格式的代码。。。
线段树的单点更新。
模板题。
重新整理了一下 0.0
#include <stdio.h>
#define N (50005)
#define LSON (idx << 1)
#define RSON ((idx << 1) | 1)
#define MID ((l + r) >> 1)
int tree[N << 2];
void build (int l, int r, int idx)
{
if (l == r)
{
scanf ("%d", &tree[idx]);
return ;
}
build (l, MID, LSON);
build (MID + 1, r, RSON);
tree[idx] = tree[LSON] + tree[RSON];
}
int query (int L, int R, int l, ......
阅读全文