#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
using namespace std;
int dp[1010][1010];
int main()
{
int i,j,n,m;
string a,b;
while(getline(cin,a))
{
g...
分类:
其他好文 时间:
2014-11-05 19:43:25
阅读次数:
191
POJ 2533 Longest Ordered Subsequence(LIS:最长上升子序列)
http://poj.org/problem?id=2533
题意:
给你一个长度为n的数字序列, 要你求该序列中的最长(严格)上升子序列的长度.
分析:
解法一: O(n^2)复杂度.
令dp[i]==x 表示以第i个数字结尾的上升子序列中最长的为x长度.
初始化: dp[0]=0且dp[i]=1 i>=1时.
状态转移: dp[i] =...
分类:
其他好文 时间:
2014-11-05 13:04:35
阅读次数:
188
poj_2533_Longest Ordered Subsequence poj_1260_Pearls hdu_1025_Constructing Roads In JGShining's King hdu_1074_Doing Homework...
分类:
其他好文 时间:
2014-11-04 17:39:20
阅读次数:
144
POJ 1458 Common Subsequence(最长公共子序列LCS)
http://poj.org/problem?id=1458
题意:
给你两个字符串, 要你求出两个字符串的最长公共子序列长度.
分析:
本题不用输出子序列,很简单,直接处理即可.
首先令dp[i][j]==x表示A串的前i个字符和B串的前j个字符的最长公共子序列长度为x.
初始化: dp全为0.
状态转移:
If A[i]==B[j] then...
分类:
其他好文 时间:
2014-11-03 16:27:00
阅读次数:
354
最长公共子序列描述咱们就不拐弯抹角了,如题,需要你做的就是写一个程序,得出最长公共子序列。 tip:最长公共子序列也称作最长公共子串(不要求连续),英文缩写为LCS(Longest Common Subsequence)。其定义是,一个序列 S ,如果分别是两个或多个已知序列的子序列,且是所有符合此...
分类:
其他好文 时间:
2014-11-02 18:09:18
阅读次数:
172
http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=465&page=show_problem&problem=2399最长的很简单,将串翻转过来后求两个串的lcs就是答案。。主要是字典序那里。。...
分类:
其他好文 时间:
2014-11-02 17:51:53
阅读次数:
260
Revenge of LIS IIProblem DescriptionIn computer science, the longest increasing subsequence problem is to find a subsequence of a given sequence in wh...
分类:
其他好文 时间:
2014-11-02 12:04:13
阅读次数:
140
Longest Ordered SubsequenceDescriptionA numeric sequence of ai is ordered if a1 File Name: poj2533.cpp 3 > Author: Enumz 4 > Mail: 369372123@...
分类:
其他好文 时间:
2014-10-30 16:56:36
阅读次数:
164
Given a stringSand a stringT, count the number of distinct subsequences ofTinS.A subsequence of a string is a new string which is formed from the orig...
分类:
其他好文 时间:
2014-10-30 07:06:13
阅读次数:
171