[DP-LIS] POJ 2533
来源:互联网 发布:淘宝访问量怎么提高 编辑:程序博客网 时间:2024/05/23 16:33
题意
LIS
思路
LIS
代码
#include <algorithm>#include <cstdio>#include <cstring>#include <iostream>#define N 1005#define INF 0x7f7f7f7fusing namespace std;int dp[ N ];int val[ N ];int LIS ( int n ) { int mx = 0; for ( int i = 0; i < n; ++i ) { dp[ i ] = 1; for ( int j = 0; j < i; ++j ) { if ( val[ j ] < val[ i ] && dp[ i ] < dp[ j ] + 1 ) dp[ i ] = dp[ j ] + 1; } if ( mx < dp[ i ] ) mx = dp[ i ]; } return mx;}int main () { int n; while ( ~scanf ( "%d", &n ) ) { for ( int i = 0; i < n; ++i ) scanf ( "%d", &val[ i ] ); int sol = LIS ( n ); printf ( "%d\n", sol ); } return 0;}
阅读全文
0 0
- poj 2533 DP(LIS)
- [DP-LIS] POJ 2533
- POJ 2533 Longest Ordered Subsequence DP(LIS)
- poj 1836 dp lis
- POJ 3670 DP LIS?
- poj-3616 DP,LIS
- POJ 1836 Alignment DP(LIS)
- poj 1836 Alignment (DP LIS)
- POJ 1836 Alignment(DP LIS)
- [POJ 1836]Alignment[DP][LIS]
- POJ 1836 Alignment DP LIS
- POJ 2533-Longest Ordered Subsequence(DP:LIS)
- POJ 2533 Longest Ordered Subsequence(dp LIS)
- POJ 2533 Longest Ordered Subsequence (DP)【 LIS】
- DP LIS(最长上升子序列) POJ 2533 POJ 1836 POJ 2138 HDU 1069
- POJ 2533 LIS模板
- POJ 2533 LIS
- POJ 2533 LIS N2
- 从今天开始自学PYTHON啦!
- Play with lkvm
- stack的使用
- spring配置bean的细节一
- 怎么高效学习
- [DP-LIS] POJ 2533
- 给定一棵二叉树,找到它的最小深度。最小深度是从根节点到最近叶节点的最短路径上的节点数量
- nexus安装
- 数据结构->单链表的操作
- CSS3 width:fit-content属性
- HTML笔记3
- 从一道题看为什么你的工作年限不值钱
- CUDA动态并行
- python web py入门-1-web.py简介和安装