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.
1 3 3 2 1
\ ...
分类:
其他好文 时间:
2015-04-24 12:40:04
阅读次数:
138
树的点分治
可以看09年漆子超论文,说的很详细.
Tree
Time Limit: 1000MS
Memory Limit: 30000K
Total Submissions: 12650
Accepted: 4025
Description
Give a tree with n vertices,each...
分类:
其他好文 时间:
2015-04-24 12:40:54
阅读次数:
120
Problem Description
Have you ever played quoit in a playground? Quoit is a game in which flat rings are pitched at some toys, with all the toys encircled awarded.
In the field of Cyberground, the po...
分类:
其他好文 时间:
2015-04-24 12:41:18
阅读次数:
148
设备管理工具抽象框架...
分类:
其他好文 时间:
2015-04-24 12:41:32
阅读次数:
164
SINGLETON(单例模式)—对象创建型模式
单例其实就是唯一实例的意思,也就是说一个类只能有一个实例。开发人员都知道,在Java中,只要new一个类,就会创建这个类的实例,如果把这个类new多次,就会创建这个类的多个实例。有时候如果在程序运行时,不管new多少次,只需要这个类的一个实例,如日志记录中的管理类,要怎么处理呢?这是就需要用到单例模式。
1. 问题...
分类:
其他好文 时间:
2015-04-24 12:41:07
阅读次数:
172
servlet中的请求转发主要有三种方式:1、 forward:是指转发,将当前request和response对象保存,交给指定的url处理。并没有表示页面的跳转,所以地址栏的地址不会发生改变。2、 redirect:是指重定向,包含两次浏览器请求,浏览器根据url请求一个新的页面,所有的业务处理都转到下一个页面,地址栏的地址会变发生改变。3、 include:意为包含,即包含url中的内容,进一步理解为,将url中的内容包含进当前的servlet当中来,并用当前servlet的request和respo...
分类:
其他好文 时间:
2015-04-24 12:39:17
阅读次数:
184
原文:http://blog.csdn.net/kk185800961/article/details/12276449
SQLServer 2008 R2
SSIS_Foreach 循环容器_Foreach 文件枚举器(导入路径下的所有txt文件的内容)
1. 拖动一个 【Foreach 循环容器】到【控制流】中,再拖动一个【数据流任务】到【Foreach 循环容器】中。如...
分类:
其他好文 时间:
2015-04-24 12:40:56
阅读次数:
364
problem:
Given an index k, return the kth row of the Pascal's triangle.
For example, given k = 3,
Return [1,3,3,1].
Note:
Could you optimize your algorithm to use only O(k) extra spac...
分类:
其他好文 时间:
2015-04-24 12:40:14
阅读次数:
151
问题描述对于一个给定的数组,找出2个数,它们满足2个数的和等于一个特定的数,返回这两个数的索引。(从1开始)
Given an array of integers, find two numbers such that they add up to a specific target number.The function twoSum should return indices of the t...
分类:
其他好文 时间:
2015-04-24 12:38:32
阅读次数:
132
斯特林数:
1. 第一类斯特林数:
a) S(n,k)意义:
将n个物体排成k个非空循环排列的方法数。也就是把n个数分成k个非空置换群的方法数。
b) 递推公式:
S(n,k) = (n-1)*S(n-1,k) + S(n-1,k-1) , 1
S(n,0) = 0 , n >= 1
S(n,n) = 1 , n >= 0
c) 性质:
|S(n,1)| = (n-1)...
分类:
其他好文 时间:
2015-04-24 12:37:32
阅读次数:
150
【题目链接】:Click here~~
【题意】:
给 n 块砖头,开始各为一堆,两种操作:
1、把 X 所在的那一堆箱子里的砖头放到 Y 所在的那一堆上面。
2、询问 X 下面有多少块砖。
【解题思路】:好像大家都叫它带权并查集,那为了方便,这里也这样叫吧,因为涉及前面的和后面的箱子个数,对应的查找操作,一开始想用结构体来写,在结构体里定义每个箱子的前驱和后...
分类:
其他好文 时间:
2015-04-24 12:37:49
阅读次数:
120
提示:
这种方法解压后会释放所有文件在你选择的路径下,但是有个缺点是不会删除解压的文件
需要在项目中添加XUnzip.cpp和XUnzip.h代码:(需要的朋友可留言)
//载入zip资源包
BOOL ui_dlg_main::LoadZipFileToDir(LPSTR lpDir) //lpDir为载入资源包的路径
{
OPENFILENAMEA ofn = { 0 };
char ...
分类:
其他好文 时间:
2015-04-24 12:36:49
阅读次数:
92
Problem Description
The highest building in our city has only one elevator. A request list is made up with N positive numbers. The numbers denote at which floors the elevator will stop, in specified ...
分类:
其他好文 时间:
2015-04-24 12:37:35
阅读次数:
123
最近新公司在用Spring MVC,跟踪Spring的Service发现是通过动态代理来实现的,而公司的事务是配置在Service层。所以想看下Spring 的AOP的具体实现。本文源码基于Spring 4.0。
我们可以使用debug跟踪一次Service调用的整体流程,可以清晰的看到一次流程处理:
CglibAopProxy.intercept方法,该方法中通过 this.advise...
分类:
其他好文 时间:
2015-04-24 12:35:24
阅读次数:
194
题目:
实现一个函数,输入一个整数,输出该数二进制表示中1的个数。如9的二进制是1001,因此输入9输出2。
解法一:可能死循环
int num1(int n)
{
int count =0;
while(n)
{
if(n&1) count++;
n=n>>1;
}
return count;...
分类:
其他好文 时间:
2015-04-24 12:33:52
阅读次数:
115
http://acm.hdu.edu.cn/showproblem.php?pid=2665
Problem Description
Give you a sequence and ask you the kth big number of a inteval.
Input
The first line is the number of the t...
分类:
其他好文 时间:
2015-04-24 12:33:31
阅读次数:
116
hdu 3625 Examining the Rooms
题意:
好难描述
思路:
第一类斯特林数,其实分子就是枚举房间1和剩下的房间绑在一起的情况,为(n-1)*sigma(i=1~k,sti[n-1][i])。
/*hdu 3625 Examining the Rooms
题意:
好难描述
思路:
第一类斯特林数,其实分子就是枚举房间1和剩下的房间绑在一起的情...
分类:
其他好文 时间:
2015-04-24 12:34:38
阅读次数:
94