题目链接食物链类似的题,主要是在于转化,a-b的和为s,转换为b比a-1大s。然后并查集存 
此节点到根的差。假如x的根为a,y的根为b:b - y = rank[y]a - x = rank[x]y - x = s可以推出b - a = rank[y] 
- rank[x] + s;并查集 延迟更新什...
                            
                            
                                分类:
其他好文   时间:
2014-05-09 18:38:05   
                                阅读次数:
213
                             
                    
                        
                            
                            
                                IntroductionThis article is part of the ongoing 
series I’ve been writing recently, but can be read as a standalone article. I’m 
going to do a better j...
                            
                            
                                分类:
其他好文   时间:
2014-05-08 13:01:13   
                                阅读次数:
599
                             
                    
                        
                            
                            
                                check a int number is power of 2?
个人信息:就读于燕大本科软件工程专业 目前大三;
本人博客:google搜索“cqs_2012”即可;
个人爱好:酷爱数据结构和算法,希望将来从事算法工作为人民作出自己的贡献;
博客内容:how many does the factorial of n have zero?
博客时间:2014-5...
                            
                            
                                分类:
其他好文   时间:
2014-05-07 21:38:00   
                                阅读次数:
411
                             
                    
                        
                            
                            
                                Popular Rice Recipe
Did you know that there are over 40,000 varieties of Rice in the world ? There are so many dishes that can be prepared with Rice too. A famous chef from Mumbai, Tid Gusto prep...
                            
                            
                                分类:
其他好文   时间:
2014-05-07 04:05:46   
                                阅读次数:
428
                             
                    
                        
                            
                            
                                http://acm.hdu.edu.cn/showproblem.php?pid=3038
这是一道并查集题目,这并查集感觉好难写,构思花了我很长很长时间,不过打码时间很短。考虑清楚之后明显快多了
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#define N 200010
using names...
                            
                            
                                分类:
其他好文   时间:
2014-05-07 04:03:06   
                                阅读次数:
331
                             
                    
                        
                            
                            
                                前言
  系列文章:[传送门]
  继续干起来!!
 
正文 
   我们已经接触过函数,函数是可以被引用的(访问或者以其他变量作为其别名),也作为参数传入函数,以及作为列表和字典等等容器对象的元素(function)的参数(arguments)传递。
      传递函数
      形式参数
            位置参数
        默认参数
     ...
                            
                            
                                分类:
编程语言   时间:
2014-05-07 03:31:03   
                                阅读次数:
369
                             
                    
                        
                            
                            
                                You can Solve a Geometry Problem tooTime Limit: 
2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total 
Submission(s): 6837 Accep...
                            
                            
                                分类:
其他好文   时间:
2014-05-07 01:14:20   
                                阅读次数:
395
                             
                    
                        
                            
                            
                                题目原文:
    Given n, how many structurally unique BST's (binary search trees) that store values 1...n?
For example,Given n = 3, there are a total of 5 unique BST's.
题目理解...
                            
                            
                                分类:
其他好文   时间:
2014-05-06 22:15:57   
                                阅读次数:
415
                             
                    
                        
                            
                            
                                n! 末尾有多少个 0
个人信息:就读于燕大本科软件工程专业 目前大三;
本人博客:google搜索“cqs_2012”即可;
个人爱好:酷爱数据结构和算法,希望将来从事算法工作为人民作出自己的贡献;
博客内容:travel the binary tree by level 5 ( from down to top and from left to right ever...
                            
                            
                                分类:
其他好文   时间:
2014-05-06 21:19:02   
                                阅读次数:
554
                             
                    
                        
                            
                            
                                这道题看似简单,其实很坑爹啊,动不动就是Time Limit Exceeded, 
比如我下面这段TLE的代码,我感觉方法是对的,但是too 
naive,算法复杂度到了O(N^2),自然就TLE了而且有一些小语法错误需要注意:for(runner=current+1;;)不能用>;一定所有的case都...
                            
                            
                                分类:
其他好文   时间:
2014-05-06 11:31:09   
                                阅读次数:
405