Qiuqiqiu  
不管道路多么崎岖坎坷,我永远不停下追逐梦想的脚步!

2012年2月14日

摘要: http://acm.hdu.edu.cn/showproblem.php?pid=1698刚开始学线段树,代码差不多是抄的View Code 1 //1698 2 #include <stdio.h> 3 const int N=100010; 4 int st[4*N],co[4*N]; 5 void newup(int rt) 6 { 7 st[rt]=st[rt*2]+st[rt*2+1]; 8 } 9 void newdown(int rt,int cnt)10 {11 if (!co[rt]) return;12 co[rt*2]=co[rt*2+1]=c... 阅读全文
posted @ 2012-02-14 21:57 Qiuqiqiu 阅读(171) 评论(0) 推荐(0) 编辑
 
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=1754刚开始学线段树View Code 1 //hdu 1754 2 #include <stdio.h> 3 const int N=200000; 4 int st[4*N]; 5 int max(int a,int b) 6 { 7 return a>b?a:b; 8 } 9 void update(int rt)10 {11 st[rt]=max(st[rt*2],st[rt*2+1]);12 }13 void build(int l,int r,int rt)14 {15 ... 阅读全文
posted @ 2012-02-14 20:06 Qiuqiqiu 阅读(116) 评论(0) 推荐(0) 编辑
 
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=1166开始学线段树,代码基本上是抄的View Code 1 //hdu 1166 2 #include <stdio.h> 3 const int N=50010; 4 int st[4*N],n; 5 void build(int l,int r,int rt) 6 { 7 if (l==r) 8 { 9 scanf("%d",&st[rt]);10 return;11 }12 int m=(l+r)/2;13 build(l,m,r... 阅读全文
posted @ 2012-02-14 19:05 Qiuqiqiu 阅读(117) 评论(0) 推荐(0) 编辑