标签:
int c[2*K]; void add(int x,int v) { when(x<=n) { c[x]+=v; x+=x&(-x); } } int get_sum(int x) { int ret=0; while(x>0) { ret+=c[x]; x-=x&(-x); } return ret; }
树状数组-模板
原文地址:http://www.cnblogs.com/weeping/p/5483748.html