C++复制int BIT[MAXN],n; //给索引X的元素加上数值val void add(int x,int val) { for(;x<=n;x+=x&-1) { BIT[x]+=val; } }