syms f x1 x2 f=(1/2)*x1^2+x2^2; x=[2;1]; a=[1 0;0 2];% A g1=diff(f,x1); g2=diff(f,x2); g=[g1;g2];%导数 % x1 g11=subs(g1,{x1,x2},{x(1) x(2)}); g22=subs(g... ...
                            
                            
                                分类:
其他好文   时间:
2018-05-10 21:47:36   
                                阅读次数:
1049
                             
                    
                        
                            
                            
                                该题是要求出字符串中最长的递增子序列的长度。第一种方法的解决思路是动态规划,定义一个与输入数组等长的整型数组,用于记录在该位置前的最长递增子序列长度。 代码如下: 还有一个就是使用二分查找的方法。 代码如下: END ...
                            
                            
                                分类:
其他好文   时间:
2018-05-08 17:43:58   
                                阅读次数:
176
                             
                    
                        
                            
                            
                                    DreamGrid is learning the LIS (Longest Increasing Subsequence) problem and he needs to find the longest increasing subsequence of a given sequence of  ...
                            
                            
                                分类:
其他好文   时间:
2018-05-08 14:40:35   
                                阅读次数:
256
                             
                    
                        
                            
                            
                                    BaoBao has just found a strange sequence {<, >, <, >, , <, >} of length in his pocket. As you can see, each element <, > in the sequence is an ordered ...
                            
                            
                                分类:
移动开发   时间:
2018-05-08 14:37:31   
                                阅读次数:
571
                             
                    
                        
                            
                            
                                    题目描述 给出一个无序的整形数组,找到最长上升子序列的长度。 例如, 给出 [10, 9, 2, 5, 3, 7, 101, 18], 最长的上升子序列是 [2, 3, 7, 101],因此它的长度是4。因为可能会有超过一种的最长上升子序列的组合,因此你只需要输出对应的长度即可。 解题思路 用动态规 ...
                            
                            
                                分类:
其他好文   时间:
2018-05-07 23:47:54   
                                阅读次数:
224
                             
                    
                        
                            
                            
                                    Problem 2216 The Longest Straight Accept: 523 Submit: 1663Time Limit: 1000 mSec Memory Limit : 32768 KB Accept: 523 Submit: 1663Time Limit: 1000 mSec  ...
                            
                            
                                分类:
其他好文   时间:
2018-05-06 10:30:31   
                                阅读次数:
186
                             
                    
                        
                            
                            
                                    题目描述: We define a harmonious array is an array where the difference between its maximum value and its minimum value is exactly 1. Now, given an intege ...
                            
                            
                                分类:
其他好文   时间:
2018-05-04 21:58:15   
                                阅读次数:
205
                             
                    
                        
                            
                            
                                原文链接http://www.cnblogs.com/zhouzhendong/p/8982484.html 题目传送门 - SPOJ LCS2 题意 求若干$(若干<10)$个字符串的最长公共连续子串长度。 串长$\leq 100000$ 题解 建议在做本题之前,先去做SPOJ LCS,本题是其升 ...
                            
                            
                                分类:
其他好文   时间:
2018-05-02 22:14:49   
                                阅读次数:
162
                             
                    
                        
                            
                            
                                    题意: 给出一个矩阵,找出这个矩阵中严格最长下降序列的长度,可以从上下左右四个方向下降。 思路: 记忆化搜索一遍即可。 代码: ...
                            
                            
                                分类:
其他好文   时间:
2018-05-02 02:27:44   
                                阅读次数:
123
                             
                    
                        
                            
                            
                                    一个整数集合S是合法的,指S的任意子集subS有Fun(SubS)!=X,其中X是一个固定整数,Fun(A)的定义如下: A为一个整数集合,设A中有n个元素,分别为a0,a1,a2,...,an-1,那么定义:Fun(A)=a0 or a1 or ... or an-1;Fun({}) = 0,即空 ...
                            
                            
                                分类:
其他好文   时间:
2018-04-30 17:57:41   
                                阅读次数:
135