2013年7月27日
摘要: 基本上即使原来函数有的操作,更新和查询,sub的时候改成负数。 1 #include 2 #include 3 int c[1000005],n; 4 int lowbit(int x) 5 { 6 return x&(-x); 7 } 8 int sum(int x) 9 {10 int ret=0;11 while(x>0)12 {13 ret+=c[x];14 x-=lowbit(x);15 }16 return ret;17 }18 void add(int x,int d)19 {20 while... 阅读全文
posted @ 2013-07-27 20:25 Ac_国士无双 阅读(150) 评论(0) 推荐(0) 编辑