int lowbit(int x)
{
return x&(-x);
}
void update(int x,int y) 单点修改
while(x<=n)
c[x]+=y,x+=lowbit(x);
int sum(int x) 区间求和
int res=0;
while(x) res+=c[x],x-=lowbit(x);
return res;
感谢各位与信奥一本通的鼎力相助!