#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
                             
                         
                    
                        
                            
                            
                                Longest Common PrefixWrite a function to find the longest common prefix string amongst an array of strings.思路:设置一个位数记录器num,遍历所有字符串的第num位。如果都相同,则num++。...
                            
                            
                                分类:
其他好文   时间:
2014-11-04 14:46:17   
                                阅读次数:
196
                             
                         
                    
                        
                            
                            
                                DP。还是LCS问题。
应该是有空格或者 Tab 。用scanf 就WA了。gets 就AC了。
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#define INF 0x7fffffff
#define eps 1...
                            
                            
                                分类:
其他好文   时间:
2014-11-04 13:13:12   
                                阅读次数:
103
                             
                         
                    
                        
                            
                            
                                最长公共子序列描述咱们就不拐弯抹角了,如题,需要你做的就是写一个程序,得出最长公共子序列。 tip:最长公共子序列也称作最长公共子串(不要求连续),英文缩写为LCS(Longest Common Subsequence)。其定义是,一个序列 S ,如果分别是两个或多个已知序列的子序列,且是所有符合此...
                            
                            
                                分类:
其他好文   时间:
2014-11-02 18:09:18   
                                阅读次数:
172
                             
                         
                    
                        
                            
                            
                                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
                             
                         
                    
                        
                            
                            
                                题目:Given a string, find the length of the longest substring without repeating characters. For example, the longest substring without repeating letters...
                            
                            
                                分类:
编程语言   时间:
2014-11-01 23:10:30   
                                阅读次数:
279
                             
                         
                    
                        
                            
                            
                                题目链接:poj 3764 The xor-longest Path
题目大意:给定一棵树,每条边上有一个权值,找出一条路径,使得路径上权值的亦或和最大。
解题思路:dfs一遍,预处理出每个节点到根节点路径的亦或和rec,那么任意路径均可以表示rec[a] ^ rec[b],所以问题
就转换成在一些数中选出两个数亦或和最大,那么就建立字典树查询即可。
#include 
#in...
                            
                            
                                分类:
其他好文   时间:
2014-10-30 23:57:58   
                                阅读次数:
424
                             
                         
                    
                        
                            
                            
                                Write a function to find the longest common prefix string amongst an array of strings.找出所有字符串的最长公共前缀。 1 public class Solution { 2 public String lo...
                            
                            
                                分类:
其他好文   时间:
2014-10-30 20:40:26   
                                阅读次数:
222