#include#includeint main(){ char s[100001],t[100001]; char *p1,*p2; while(scanf("%s%s",s,t)!=EOF) { p1=s; p2=t; while...
                            
                            
                                分类:
其他好文   时间:
2015-05-25 23:57:27   
                                阅读次数:
158
                             
                         
                    
                        
                            
                            
                                Given a string S and a string T, count the number of distinct subsequences of T in S.A subsequence of a string is a new string which is formed from th...
                            
                            
                                分类:
编程语言   时间:
2015-05-24 12:51:44   
                                阅读次数:
114
                             
                         
                    
                        
                            
                            
                                题目链接:http://poj.org/problem?id=2533思路分析:该问题为经典的最长递增子序列问题,使用动态规划就可以解决;1)状态定义:假设序列为A[0, 1, .., n],则定义状态dp[i]为以在所有的递增子序列中以A[i]为递增子序列的最后一个数字的所有递增子序列中的最大长度...
                            
                            
                                分类:
其他好文   时间:
2015-05-23 21:13:07   
                                阅读次数:
133
                             
                         
                    
                        
                            
                            
                                http://poj.org/problem?id=3017
Description
Given an integer sequence { an } of length N, you are to cut the sequence into several parts every one of which is a consecutive subsequence of the ori...
                            
                            
                                分类:
其他好文   时间:
2015-05-18 16:52:11   
                                阅读次数:
130
                             
                         
                    
                        
                            
                            
                                1553: Good subsequence
Time Limit: 2 Sec  Memory Limit: 
256 MB
Submit: 549  Solved: 190
[Submit][Status][Web
 Board]
Description
Give you a sequence of n numbers, and a number k you should f...
                            
                            
                                分类:
其他好文   时间:
2015-05-18 09:05:43   
                                阅读次数:
119
                             
                         
                    
                        
                            
                            
                                最长公共子序列,其实就是最长上升子序列的变形。  dp[i][j]表示以第一个序列的i位置为结尾和以第二个序列的j位置为结尾的子序列的公共子序列的长度。
显然影响决策的因素就是这两个序列的位置,所以二重循环直接搞就行了,如果这两个位置的字符相同就+1
#include
#include
#include
#include
#include
using namespace std;
char s...
                            
                            
                                分类:
其他好文   时间:
2015-05-17 18:46:02   
                                阅读次数:
125
                             
                         
                    
                        
                            
                            
                                题目描述:Find a longest common subsequence of two strings.输入:First and second line of each input casecontain two strings of lowercase character a…z. There...
                            
                            
                                分类:
其他好文   时间:
2015-05-16 18:13:58   
                                阅读次数:
99
                             
                         
                    
                        
                            
                            
                                Problem Description
There is a sequence of integers. Your task is to find the longest subsequence that satisfies the following condition: the difference between the maximum element and the minimum ...
                            
                            
                                分类:
其他好文   时间:
2015-05-16 11:57:35   
                                阅读次数:
127
                             
                         
                    
                        
                            
                            
                                (1)问题描述:给定n个整数A1,A2,A3...An。按照从左往右的顺序选择尽可能多的整数,组成一个上升子序列,其中相邻元素不能相等。
(2)解题思路:本题就是经典的最长上升子序列问题(Longest Increasing Subsequence,LIS)。可以通过动态规划解决。定义状态d(i)表示以下标i结尾的LIS的最大长度。那么不难得到如下状态转移方程:
d(i)=max{0,d(j)...
                            
                            
                                分类:
其他好文   时间:
2015-05-16 09:14:04   
                                阅读次数:
100
                             
                         
                    
                        
                            
                            
                                Longest Ordered SubsequenceTime Limit:2000MSMemory Limit:65536KTotal Submissions:32192Accepted:14093DescriptionA numeric sequence ofaiis ordered ifa1i...
                            
                            
                                分类:
其他好文   时间:
2015-05-15 10:35:45   
                                阅读次数:
128