【题目】
You are climbing a stair case. It takes n steps to reach to the top.
Each time you can either climb 1 or 2 steps. In how many distinct ways can you climb to the top?
【题意】
有个梯子有n阶,每次只能爬1阶或者2阶,为爬到梯子顶共有多少种爬法
【思路】
依次确定跳到每一阶上的爬法数目
这其实是一...
分类:
其他好文 时间:
2014-06-05 07:16:08
阅读次数:
203
这是动态规划?我一点思路怎么也没有。最后还是用矩阵部分求和枚举0MS。
题目大意:
给出一个矩阵,上面有几个点。在给一个小点儿的矩阵,求这个矩阵最多能套上几个点。(注意:小矩阵长宽给定,不能旋转)。
解题思路:
建立数组num[i][j]代表点(1,1)到点(i,j)组成的矩阵里有几个点。
下面是代码:
#include
#include
int num[1...
分类:
其他好文 时间:
2014-06-05 06:14:33
阅读次数:
226
链接:http://poj.org/problem?id=3259
Description
While exploring his many farms, Farmer John has discovered a number of amazing wormholes. A wormhole is very peculiar because it is a one-way path t...
分类:
其他好文 时间:
2014-06-05 05:26:33
阅读次数:
240
【题目】
Given an array of words and a length L, format the text such that each line has exactly L characters and is fully (left and right) justified.
You should pack your words in a greedy approach; that is, pack as many words as you can in each line. Pad ...
分类:
其他好文 时间:
2014-06-04 22:37:46
阅读次数:
389
The Blocks Problem
Background
Many areas of Computer Science use simple, abstract domains for both analytical and empirical studies. For example, an early AI study of planning and robo...
分类:
其他好文 时间:
2014-06-04 21:55:37
阅读次数:
313
Follow up for "Unique Paths":Now consider if
some obstacles are added to the grids. How many unique paths would there be?An
obstacle and empty space i...
分类:
其他好文 时间:
2014-06-04 19:54:55
阅读次数:
258
You are climbing a stair case. It takesnsteps
to reach to the top.Each time you can either climb 1 or 2 steps. In how many
distinct ways can you climb...
分类:
其他好文 时间:
2014-06-04 19:53:34
阅读次数:
173
【题目】
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
\ / / / \ 3 2 1 ...
分类:
其他好文 时间:
2014-06-01 15:34:24
阅读次数:
231
题意:写出一个给定区间的每个数,求出一共写了多少个零。解法:数位DP,定义dp[len][flag][num]:len的定义为数位的长度,flag定义为前导0和没有前导0的两种状态,num定义为写的满足条件的0的个数。
1 #include 2 #include 3 #include 4 #incl...
分类:
其他好文 时间:
2014-06-01 11:48:35
阅读次数:
167
Lucene是一个高性能的java全文检索工具包,它使用的是倒排文件索引结构。该结构及相应的生成算法如下:
0)设有两篇文章1和2 文章1的内容为:Tom lives in Guangzhou,I live in Guangzhou too. 文章2的内容为:He
once lived i...
分类:
其他好文 时间:
2014-05-31 15:14:01
阅读次数:
302