POJ 1887 Testing the CATCHER
来源:互联网 发布:jsp与php运行环境区别 编辑:程序博客网 时间:2024/06/10 20:13
最长递减序列问题.
#include <cstdio>#include <algorithm>#include <memory.h>using namespace std;const int MAX = 5000;int dp[MAX], g[MAX], A[MAX];int main(int argc, char const *argv[]){int h, caseno = 1;while(scanf("%d", &h) && h != -1){if(caseno != 1){printf("\n");}int idx = 0, ans = 0;do{A[idx++] = h;}while(scanf("%d", &h) && h != -1);reverse(A, A + idx);memset(g, 0x20, sizeof(g));for(int i = 0; i < idx; ++i){int k = lower_bound(g + 1, g + idx + 1, A[i]) - g;dp[i] = k;g[k] = A[i];ans = max(dp[i], ans);}printf("Test #%d:\n maximum possible interceptions: %d\n", caseno++, ans);}return 0;}
0 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)
- 开辟动态数组、printf
- POJ 3067 Japan(树状数组:求逆序)
- 【ubuntu 12.04 安装cmake】
- win7(windows 7)系统下安装SQL2005(SQL Server 2005)图文教程
- 2012-10-20 NOIP模拟赛
- POJ 1887 Testing the CATCHER
- 字符设备(4)ioctl
- Java生产者和消费者问题
- sort函数
- 当太阳不再上升的时候
- json转树状结构(js)
- SQL Server2005排名函数
- 《数据结构》、《软件工程》、《C语言》等专业课后
- HDU2045 不容易系列之(3)—— LELE的RPG难题