摘要: http://www.java3z.com/cwbwebhome/article/article1/1369.html推荐的博文referrence:http://community.topcoder.com/tc?module=Static&d1=tutorials&d2=binaryIndexedTrees对于正整数,我们定义lowbit(x)为x的二进制表达式中最右边1所对应的值。对于节点i,如果它是左子节点,那么父节点的编号就是i+lowbit(i),如果它是右子节点,那么父节点的编号是i-lowbit(i),构造一个辅助数组C,其中 Ci=A[i-lowbit(i)+ 阅读全文
posted @ 2013-05-20 21:50 小仪在努力~ 阅读(211) 评论(0) 推荐(0) 编辑
摘要: #include<iostream>#include<cstdio>#include<cstring>#include<cmath>#include<algorithm>#include<string>#include<queue>using namespace std;int c[100005],n;int lowbit(int x){ return x&-x;}int sum(int x){ int ret=0; while(x>0) { ret+=c[x];x-=lowbit(x); } r 阅读全文
posted @ 2013-05-20 18:44 小仪在努力~ 阅读(111) 评论(0) 推荐(0) 编辑