HOJ10001
来源:互联网 发布:网站数据久了数据很多 编辑:程序博客网 时间:2024/06/07 14:19
最长上升子序列
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include<iostream>
#include<string.h>
#define inf 0x3f3f3f
using namespace std;
int a[1000],dp[1000],n,maxx;
int main()
{
while(scanf("%d",&n) != EOF)
{
for(int i = 0 ; i < n ;i++)
dp[i] = 1;
for(int i = 0 ;i < n ;i++)
scanf("%d",&a[i]);
for(int i = 1 ;i < n ;i++)
{
for(int j = 0 ;j < i ;j++)
{
if(a[i] > a[j] && dp[i] < dp[j] + 1)
dp[i] = dp[j] + 1;
}
}
maxx = 0;
for(int i = 0 ;i < n ;i++)
{
if(maxx < dp[i])
maxx = dp[i];
}
printf("%d\n",maxx);
}
return 0;
}
- HOJ10001
- getchar、getche与getch的区别
- ActionScript3开源库大全
- 在notepad++中 “tab转为空格”、“按tab插入空格”、“文档格式转换”
- No result defined for action action.QueryAction and result result
- 手把手教你TestComplete_数据库外键关联问题
- HOJ10001
- Uninstall ParetoLogic DriverCure
- Remove System Recovery Scareware
- 加速 PB5.0 的编译
- QML Data Models 数据模型<一>
- 34个有用的ActionScript 3.0的API
- 加快Myeclipse启动速度
- Tweener 語法實習
- 不同的编译器、不同的硬件平台以及不同的操作系统,最终编译出来的结果一样吗?为什么?