随笔分类 - 动态规划---LIS
摘要:題目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1087 思路:动态规划 求n个点的和最大上升子序列 d[i]=max(d[j]+a[i]),(j<i且a[j]<a[i])
阅读全文
摘要:1 O(n^2)的方法: 2 #include <iostream> 3 #include <stdio.h> 4 #include <cstring> 5 #include <algorithm> 6 using namespace std; 7 int a[15010],dp[15010],fr
阅读全文
摘要:We are all familiar with sorting algorithms: quick sort, merge sort, heap sort, insertion sort, selection sort, bubble sort, etc. But sometimes it is
阅读全文
摘要:A numeric sequence of ai is ordered if a1 < a2 < ... < aN. Let the subsequence of the given numeric sequence ( a1, a2, ..., aN) be any sequence ( ai1,
阅读全文
摘要:给出长度为N的数组,找出这个数组的最长递增子序列。(递增子序列是指,子序列的元素是递增的) 例如:5 1 6 8 2 4 5 10,最长递增子序列是1 2 4 5 10。 给出长度为N的数组,找出这个数组的最长递增子序列。(递增子序列是指,子序列的元素是递增的) 例如:5 1 6 8 2 4 5 1
阅读全文