首页 > 其他 > 详细

线段树的基本运算

时间:2020-02-12 11:29:18      阅读:61      评论:0      收藏:0      [点我收藏+]
#include<cstdio>
#include<cstring>
const int maxn=100010;
#define lowbit(i) ((i)&(i))
int c[maxn];
void update(int x,int v) {
 for(int i=x;i<maxn;i+=lowbit(i)) {
  c[i]+=v;
 }
}
int getsum(int x) {
 int sum=0;
 for(int i=x;i>=;i-=lowbit(i)) {
  sum+=c[i];
 }
 return sum;
}

线段树的基本运算

原文:https://www.cnblogs.com/superPG/p/12298097.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!