最长上升子序列
0x3f3f3f3f
这个作者很懒,什么都没留下…
展开
-
POJ 1887 —— Testing the CATCHER 最长下降子序列
原题:http://poj.org/problem?id=1887求最长下降子序列个数注意输出格式!O(n²)#include#includeusing namespace std;int dp[100000000];int a[100000000];int cas = 0;int main(){ int tmp; while(~scanf("%d",原创 2016-03-07 20:47:38 · 744 阅读 · 0 评论 -
POJ 2533 —— Longest Ordered Subsequence 最长上升子序列裸题
原题:http://poj.org/problem?id=2533题意:求最长递增子序列注意:n = 0 n = 1 答案都是1#includeconst int maxn = 1100;int n;int dp[maxn];int a[maxn];int main(){ while(~scanf("%d", &n)) { int ans = 0;原创 2016-02-20 23:49:33 · 451 阅读 · 0 评论 -
POJ 1631 —— Bridging signals 最长上升子序列
原题:http://poj.org/problem?id=1631题意:有n个数,求最长上升子序列的个数;#include#includeusing namespace std;const int maxn = 40000+10;int stack[maxn];int cas, n;int main(){ scanf("%d", &cas); while(cas原创 2016-03-07 21:04:42 · 340 阅读 · 0 评论 -
POJ 3903 —— Stock Exchange 最长上升子序列
原题:http://poj.org/problem?id=3903题意:求最长上升子序列的个数;#include#includeusing namespace std;const int maxn = 1000000+10;int stack[maxn];int n;int main(){ while(~scanf("%d", &n)) { int top原创 2016-03-07 21:10:28 · 379 阅读 · 0 评论 -
HDU 1025 —— Constructing Roads In JGShining's Kingdom 最长上升子序列
原题:http://acm.hdu.edu.cn/showproblem.php?pid=1025题意:有n个穷城市,n个富城市,每个穷城市都要从某个富城市运输一种物资(穷城市和富城市的物资供需一对一),需要建立道路,但任意两条路不能交叉;穷城市和富城市分 别位列平行线两侧(均按1 - n 分布); 给出城市个数n,下面n行输入两个数字 p 和 r 表示穷城市p要从富城市r运原创 2016-03-07 22:43:07 · 361 阅读 · 0 评论 -
HDU 1423 —— Greatest Common Increasing Subsequence
原题:http://acm.hdu.edu.cn/showproblem.php?pid=1423题意:求最长上升公共子序列的个数;注意:每组数据之间要空一行,最后一组数据结束不需要空行;#include#include#include#includeusing namespace std;const int maxn = 510;int cas, n, m;in原创 2016-03-13 21:19:18 · 343 阅读 · 0 评论 -
HDU 1069 —— Monkey and Banana
原题:http://acm.hdu.edu.cn/showproblem.php?pid=1069#include#includeusing namespace std;const int maxn = 1100;int n;int dp[maxn];int T = 0;struct node{ int x, y, z; friend bool operato原创 2016-07-02 16:52:18 · 292 阅读 · 0 评论