Pku1887----Testing the CATCHER (经典动态规划题:最长下降子序列),,,,,捎带pku2533---Longest Ordered Subsequence
2009-01-10 23:15
645 查看
280K | 63MS | GCC | 600B | 2009-01-10 23:08:06 |
#include<stdio.h>
int a[1005],best[1005];
int n;
void input()
{
int i;
scanf("%d",&n);n++;
for(i=1;i<n;i++)
scanf("%d",&a[i]);
}
void process()
{
int i,j,max;
best[1] = 1;max=1;
for(i=2;i<n;i++){
best[i] = 1;
for(j=1;j<i;j++){
if(a[j]<a[i]&&best[j]+1>best[i])
best[i]=best[j]+1;
}
if(best[i]>max)
max=best[i];
}
printf("%d\n",max);
}
int main()
{
input();
process();
return 0;
}
相关文章推荐
- 动态规划 POJ - 2533 Longest Ordered Subsequence(最长递增子序列)
- POJ 1887 Testing the CATCHER(最长下降子序列)
- POJ 1887 Testingthe CATCHER (LIS:最长下降子序列)
- POJ-1887 Testing the CATCHER(dp,最长下降子序列)
- POJ-1887 Testing the CATCHER(dp,最长下降子序列)
- POJ 1887-Testing the CATCHER(dp_最长下降子序列)
- POJ 1887 —— Testing the CATCHER 最长下降子序列
- //POj 2533 Longest Ordered Subsequence(动态规划:最长不减子序列)
- poj 2533 Longest Ordered Subsequence (最长不下降子序列)
- pku 2533 最长递增子序列 Longest Ordered Subsequence 解题报告
- POJ2533 Longest Ordered Subsequence(最长递增子序列)
- poj 1887 Testing the CATCHER_最长上升子序列
- POJ 2533 Longest Ordered Subsequence(最长上升子序列)
- POJ-1887-Testing the CATCHER【最长不上升子序列nlogn】
- POJ 2533-Longest Ordered Subsequence(dp_最长上升子序列)
- Testing the CATCHER - POJ 1887 最长递减子序列
- nlog(n)解动态规划--最长上升子序列(Longest increasing subsequence)
- UVALive5170 UVA231 POJ1887 Testing the CATCHER【最长下降子序列+DP+二分搜索】
- 【POJ 2533】Longest Ordered Subsequence(最长上升子序列LIS)
- poj2533--Longest Ordered Subsequence(dp:最长上升子序列)