题目链接:http://blog.csdn.net/u014361775/article/details/42873875题目解析:给定两行字符串序列,输出它们之间最大公共子单词的个数对于给的两个序列X 和 Y,用i 和 j分别作为它们的前缀指针,f[i][j]表示序列X的前缀Xi 和 序列Y的前缀...
分类:
其他好文 时间:
2015-01-30 19:12:19
阅读次数:
428
原题地址简单动态规划,跟最大子串和类似。一维状态空间可以经过压缩变成常数空间。代码: 1 int maxProduct(int A[], int n) { 2 if (n = 0; i--) {10 int tmp = minp;11 ...
分类:
其他好文 时间:
2015-01-30 10:36:58
阅读次数:
179
Say you have an array for which the ith element isthe price of a given stock on day i.
Design an algorithm to find the maximum profit. You may complete as manytransactions as you like (ie, buy one an...
分类:
其他好文 时间:
2015-01-30 09:11:13
阅读次数:
176
Given a binary tree, findits maximum depth.
The maximum depth is thenumber of nodes along the longest path from the root node down to the farthestleaf node.
可用递归,效率低。
这里用类似层次遍历的算法。设置一个队列和两个int变量...
分类:
其他好文 时间:
2015-01-30 09:10:56
阅读次数:
261
Maximum path sum I
Problem 18
By starting at the top of the triangle below and moving to adjacent numbers on the row below, the maximum total from top to bottom is 23.
3
7 4
2 4 6
8 5 9 ...
分类:
编程语言 时间:
2015-01-29 14:38:58
阅读次数:
330
Given a sequence of K integers { N1, N2, ..., NK}. A continuous subsequence is defined to be { Ni, Ni+1, ..., Nj} where 1 2 const int MAXX=10010; 3 i....
分类:
其他好文 时间:
2015-01-29 14:04:23
阅读次数:
177
Common Subsequence
Crawling in process...
Crawling failed
Time Limit:1000MS
Memory Limit:32768KB 64bit IO Format:%I64d & %I64u
Description
A subsequence of a given sequence...
分类:
其他好文 时间:
2015-01-29 10:26:40
阅读次数:
154
1007. Maximum Subsequence Sum (25)
时间限制
400 ms
内存限制
65536 kB
代码长度限制
16000 B
判题程序
Standard
作者
CHEN, Yue
Given a sequence of K integers { N...
分类:
其他好文 时间:
2015-01-29 09:30:29
阅读次数:
131
/*《算法竞赛入门经典第二版》 P35 习题2-4; 输入两个正整数 n int main(){ int m,n,i,j=1; while(scanf("%d%d",&m,&n) != EOF) { double sum = 0; ...
分类:
编程语言 时间:
2015-01-28 23:57:43
阅读次数:
955
Say you have an array for which the ith element is the price of a given stock on day i.
Design an algorithm to find the maximum profit. You may complete at most two transactions.
注意
You may n...
分类:
其他好文 时间:
2015-01-28 14:47:27
阅读次数:
197