poj 1887 Testing the CATCHER
来源:互联网 发布:淘宝关键词就是标题吗 编辑:程序博客网 时间:2024/06/11 01:05
题目很长,但是题却非常简单,最长递降子序列,是不是感觉无压力啊,那就快AC吧。
#include<cstdio>#include<cstring>#include<iostream>#define N 1000000#define max(a1,b1) (a1)>(b1)?(a1):(b1)using namespace std;int dp[N],arr[N],n;int main(void){ int k = 1; while(cin>>arr[1],arr[1]!=-1) { n = 1; for(int i=2;;++i) { cin>>arr[++n]; if(arr[n]==-1) { n--; break; } } //cout<<n<<endl; for(int i=1;i<=n;++i) { dp[i] = 1; for(int j=1;j<i;++j) if(arr[j]>arr[i]&&dp[j]>=dp[i]) { dp[i] = dp[j]+1; } } int ans = -1; for(int i=1;i<=n;++i) ans = max(ans,dp[i]); printf("Test #%d:\n",k++); printf(" maximum possible interceptions: %d\n\n",ans); } return 0;}
- poj 1887 Testing the CATCHER
- poj 1887 Testing the CATCHER
- poj 1887 Testing the CATCHER
- Poj 1887 Testing the CATCHER
- poj 1887 Testing the CATCHER
- POJ 1887 Testing the CATCHER
- poj 1887 Testing the CATCHER
- POJ-1887-Testing the CATCHER
- poj 1887 Testing the CATCHER
- POJ 1887 Testing the CATCHER
- POJ 1887 Testing the CATCHER
- POJ -1887-Testing the CATCHER
- POJ 1887 Testing the CATCHER.
- POJ 1887 Testing the CATCHER
- poj 1887 Testing the CATCHER
- POJ 1887 Testing the CATCHER 经典DP
- Poj 1887 Testing the CATCHER(LIS)
- POJ 1887 Testing the CATCHER(LIS)
- Linux内核哈希表分析与应用
- DPI与layout
- qt for windows 安装调试
- 海量数据处理
- .Net使用FlashPaper
- poj 1887 Testing the CATCHER
- UNIX网络编程——UNIX域套接字编程和socketpair 函数
- c++ 获取文件夹下文件名称
- iOS 应用程序本地化
- 浅析Linux Kernel 哈希路由表实现(一)
- Activity---基础总结篇之二:Activity的四种launchMode .
- 关于使用plot动态显示数据的几个实用程序
- MYSQL :逗号分隔串表,分解成竖表
- eCos 动态内存分配简介 .