摘要:        
http://acm.hdu.edu.cn/showproblem.php?pid=1541	开始知道是用树状数组做,但想了好半天不知道怎么用,总觉得要先排序才能做。但是排序的话复杂度就上去了啊。	纠结了半天才读到那句Stars are listed in ascending order of Y coordinate.擦了个擦的,早看见不完了。	c[pos]表示1到pos的和,也就是当前星星前有几个(包含当前)。用cnt记录各等级数量。code:#include<cstdlib>#include<cctype>#include<cstring>#inclu    阅读全文
        posted @ 2012-08-07 20:15
追逐.
阅读(316)
评论(0)
推荐(0)
            
        
        
摘要:        
http://acm.hdu.edu.cn/showproblem.php?pid=1166	相比与线段树,树状数组的编程难度确实很低,不容易出错,而且同等问题上效率较高些。	但是好像树状数组能解决的问题线段树都可以解决,而线段树能解决的它却不一定能解决。code:#include<cstdlib>#include<cctype>#include<cstring>#include<cstdio>#include<cmath>#include<algorithm>#include<vector>#include&    阅读全文
        posted @ 2012-08-07 12:20
追逐.
阅读(195)
评论(0)
推荐(0)
 
                    
                     
                    
                 
                    
                 
 
         浙公网安备 33010602011771号
浙公网安备 33010602011771号