Problem:Given a stringS, find the longest palindromic substring inS. You may assume that the maximum length ofSis 1000, and there exists one unique lo...
分类:
其他好文 时间:
2014-10-11 02:20:24
阅读次数:
227
题目链接:http://poj.org/problem?id=1458思路: 经典的最长公共子序列问题,使用动态规划解题。代码:#include #include using namespace std;const int MAX_N = 200 + 10;int dp[MAX_N][MAX_N]....
分类:
其他好文 时间:
2014-10-11 02:14:34
阅读次数:
201
Time Limit:3000MS Memory Limit:65536KB
Description You are given a sequence a[0]a[1] ... a[N-1] of digits and a prime number Q. For each i<=j with a[i] != 0, the subsequence a[i]a[i+1]...a[j] can be...
分类:
其他好文 时间:
2014-10-10 22:24:14
阅读次数:
256
Struts中报错the request was rejected because its size (***) exceeds the configured maximum (2097152)最新解决方案是在struts.xml中设置http://bioubiou.iteye.com/blog/1...
分类:
Web程序 时间:
2014-10-10 21:03:54
阅读次数:
166
Given n points on a 2D plane, find the maximum number of points that lie on the same straight line.Brute Force的做法,N个点两两可以构成N(N-1)/2条线,我们可以找这N(N-1)/2条线...
分类:
其他好文 时间:
2014-10-10 10:39:54
阅读次数:
167
问题: 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 co...
分类:
其他好文 时间:
2014-10-10 00:18:11
阅读次数:
398
1.概述RMQ(Range Minimum/Maximum Query),即区间最值查询,是指这样一个问题:对于长度为n的数列A,回答若干询问RMQ(A,i,j)(i,jO(nlogn){for(int j = 1; j #include #include using namespace std;c...
分类:
其他好文 时间:
2014-10-09 23:36:27
阅读次数:
627
a(i):以节点i作为终点的单边最大路径和
b(i):以节点i作为终点的双边边最大路径和
a(i) = max{ i->val,
i->val + max{a(i->left), a(i->right) }};
b(i) = max{ i->val, i->val + max{a(i->left), a(i->right) } ,
i->val + a(i->left) + a(...
分类:
其他好文 时间:
2014-10-09 22:49:47
阅读次数:
141
Problem DescriptionA subsequence of a given sequence is the given sequence with some elements (possible none) left out. Given a sequence X = another ....
分类:
其他好文 时间:
2014-10-09 21:57:27
阅读次数:
219
Given an array of non-negative integers, you are initially positioned at the first index of the array.
Each element in the array represents your maximum jump length at that position.
Determine i...
分类:
其他好文 时间:
2014-10-09 16:59:57
阅读次数:
203