摘要: 本题也可用线段树过,但代码麻烦得多。题意就不用说了,直接上代码吧。View Code 1 #include <stdio.h> 2 #include <string.h> 3 #define lowbit(x) ((x)&(-x)) 4 int a[100005],n; 5 void update(int x,int y) 6 { 7 while(x <= n) 8 { 9 a[x] += y;10 x += lowbit(x);11 }12 }13 int getsum(int x)14 {15 int ans = 0;16 ... 阅读全文
posted @ 2011-09-27 16:56 zhangteng 阅读(244) 评论(0) 推荐(0) 编辑