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 longes...
分类:
编程语言 时间:
2015-04-25 12:09:43
阅读次数:
158
题解:
f(i,j,k,l)f(i,j,k,l) 表示起点横着走 ii 步,竖着走 jj 步,终点竖着走 kk 步,横着走 ll 步时的回文方案数。
然后跑动态规划时 f(i,j,k,l)f(i,j,k,l) 可以更新
f(i+1,j,k+1,l)、f(i+1,j,k,l+1)、f(i,j+1,k+1,l)、f(i,j+1,k,l+1)f(i+1,j,k+1,l)、f(i+1,j,k,l+...
分类:
其他好文 时间:
2015-04-23 17:40:16
阅读次数:
309
Longest Palindromic Substring
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 longest palindrom...
分类:
其他好文 时间:
2015-04-17 13:55:59
阅读次数:
162
题目:Given a stringS, find the longest palindromic substring inS. You may assume that the maximum length ofSis 1000, and there exists one unique longest...
分类:
其他好文 时间:
2015-04-15 21:20:54
阅读次数:
101
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 longes...
分类:
其他好文 时间:
2015-04-13 18:24:42
阅读次数:
112
描述:Given a stringS, find the longest palindromic substring inS. You may assume that the maximum length ofSis 1000, and there exists one unique longest...
分类:
其他好文 时间:
2015-04-12 20:54:09
阅读次数:
137
4.Median of Two Sorted Arrays
5.Longest Palindromic Substring
6.ZigZag Conversion...
分类:
编程语言 时间:
2015-04-10 11:36:28
阅读次数:
149
Given a stringS, find the longest palindromic substring inS. You may assume that the maximum length ofSis 1000, and there exists one unique longest pa...
分类:
其他好文 时间:
2015-04-08 00:54:17
阅读次数:
113
Given a stringS, find the longest palindromic substring inS. You may assume that the maximum length ofSis 1000, and there exists one unique longest pa...
分类:
其他好文 时间:
2015-04-07 21:31:44
阅读次数:
120
题意:
给一个数n,求有多少种和为n的单峰先增序列,比如当n=5时结果为3:(5), (1 3 1), (1 1 1 1 1)。
分析:
转化为求类似整数拆分问题,f(i,j)的意义是把i进行拆分,最大数小于等于j的方法数。
代码:
//poj 1221
//sep9
#include
using namespace std;
const int maxN=300;
__int64 a...
分类:
其他好文 时间:
2015-04-06 21:57:14
阅读次数:
118