Paths on a Grid
Time Limit: 1000MS
Memory Limit: 30000K
Total Submissions: 21439
Accepted: 5259
Description
Imagine you are attending your math lesson at school. Once...
分类:
其他好文 时间:
2014-08-04 18:06:27
阅读次数:
298
题目:人生有很多选择,现在给你一些选择(0~n-1),和每个选择分支后面的其他选择序号,求选择总数。
分析:dp,图论。如果某状态的后续选择个数是0个则,代表死亡,统计所有到达死亡的路径条数即可。
用一个状态数组记录到达每个选择的路径数,它等于能到达它的前驱节点的路径加和。
稀疏图,使用邻接表储存。初始是节点0的路径条数为1,代表出生。
说明...
分类:
其他好文 时间:
2014-08-04 17:53:57
阅读次数:
199
SGU 407
407. Number of Paths in the Empire
Time limit per test: 0.75 second(s)
Memory limit: 65536 kilobytes
input: standard
output: standard
During the period of Tsam dynasty ruling...
分类:
编程语言 时间:
2014-08-04 17:46:17
阅读次数:
294
问题:n个结点总共有多少个二叉搜索树分析:n=1,sum1=1 n=2,sum2=2; n=3,sum3=2(头结点为1)+1(头结点为2)+2(头结点为3) n=4,sum4=5(头结点为1,sum3)+2(头结点为2,sum1*sum2)+2(头结点为3,sum2*sum1)+...
分类:
其他好文 时间:
2014-08-04 13:53:47
阅读次数:
193
题目:Given a string S, find the longest palindromic substring in S. You may assume that the maximum length of S is 1000, and there exists one unique lo....
分类:
编程语言 时间:
2014-08-04 04:10:26
阅读次数:
374
最小生成树的唯一性,POJ 1679 The Unique MST...
分类:
其他好文 时间:
2014-08-03 10:19:25
阅读次数:
261
The Unique MST
Time Limit: 1000MS
Memory Limit: 10000K
Total Submissions: 20293
Accepted: 7124
Description
Given a connected undirected graph, tell if its minimum spa...
分类:
其他好文 时间:
2014-08-02 20:58:54
阅读次数:
362
问题:从起点到终点总共有多少条路径分析:f[x,y]=f[x+1,y]+f[x,y+1],用记忆化搜索就可以解决了class Solution {public: int num[110][110]; int dfs(int m,int n,int x,int y) { ...
分类:
其他好文 时间:
2014-08-02 20:39:33
阅读次数:
165
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
\ ...
分类:
其他好文 时间:
2014-08-02 15:34:34
阅读次数:
221
题目: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 spa....
分类:
编程语言 时间:
2014-08-02 12:19:13
阅读次数:
241