2012年2月29日

线段树模板及解释

摘要: 先摆模板。。。//线段树模板struct line{int left,right;//左端点、右端点int n;//记录这条线段出现了多少次,默认为0};struct line a[100];int sum;//建立void build(int s,int t,int n){int mid=(s+t)/2;a[n].left=s;a[n].right=t;if (s==t) return;a[n].left=s;a[n].right=t;build(s,mid,2*n);build(mid+1,t,2*n+1);}//插入void insert(int s,int t,int step)//要 阅读全文

posted @ 2012-02-29 22:48 [S*I]SImMon_WCG______* 阅读(513) 评论(0) 推荐(0) 编辑

导航