题目大意:一种拦截导弹能拦截多枚导弹,但是它在每次拦截后高度不会再升高,给出导弹的序列,问最多能拦截多少枚导弹?

  最长递减子序列问题。

 #include <cstdio>
#include <vector>
#include <algorithm>
using namespace std; vector<int> m, lds; int main()
{
#ifdef LOCAL
freopen("in", "r", stdin);
#endif
int x, kase = ;
while (scanf("%d", &x) != EOF && x != -)
{
kase++;
m.clear();
m.push_back(x);
while (scanf("%d", &x) && x != -)
m.push_back(x);
lds.clear();
lds.resize(m.size(), );
for (int i = ; i < m.size(); i++)
{
for (int j = ; j < i; j++)
if (m[i] < m[j] && lds[j]+ > lds[i])
lds[i] = lds[j] + ;
}
int ans = ;
for (int i = ; i < lds.size(); i++)
ans = max(ans, lds[i]);
if (kase > ) printf("\n");
printf("Test #%d:\n maximum possible interceptions: %d\n", kase, ans);
}
return ;
}

UVa 231 - Testing the CATCHER的更多相关文章

  1. poj1887 Testing the CATCHER

    Testing the CATCHER Time Limit: 1000MS   Memory Limit: 30000K Total Submissions: 13968   Accepted: 5 ...

  2. POJ-1887 Testing the CATCHER(dp,最长下降子序列)

    Testing the CATCHER Time Limit: 1000MS Memory Limit: 30000K Total Submissions: 16515 Accepted: 6082 ...

  3. POJ 1887 Testing the CATCHER

    Testing the CATCHER Time Limit: 1000MS   Memory Limit: 30000K Total Submissions: 13396   Accepted: 4 ...

  4. POJ 1887 Testing the CATCHER(LIS的反面 最大递减子序列)

    Language: Default Testing the CATCHER Time Limit: 1000MS   Memory Limit: 30000K Total Submissions: 1 ...

  5. POJ 1887:Testing the CATCHER 求递减序列的最大值

    Testing the CATCHER Time Limit: 1000MS   Memory Limit: 30000K Total Submissions: 16131   Accepted: 5 ...

  6. Poj 1887 Testing the CATCHER(LIS)

    一.Description A military contractor for the Department of Defense has just completed a series of pre ...

  7. 一位学长的ACM总结(感触颇深)

    发信人: fennec (fennec), 信区: Algorithm 标 题: acm 总结 by fennec 发信站: 吉林大学牡丹园站 (Wed Dec 8 16:27:55 2004) AC ...

  8. ACM学习

    转:ACM大量习题题库   ACM大量习题题库 现在网上有许多题库,大多是可以在线评测,所以叫做Online Judge.除了USACO是为IOI准备外,其余几乎全部是大学的ACM竞赛题库.   US ...

  9. (转载)ACM训练计划,先过一遍基础再按此拼搏吧!!!!

    ACM大量习题题库 ACM大量习题题库 现在网上有许多题库,大多是可以在线评测,所以叫做Online Judge.除了USACO是为IOI准备外,其余几乎全部是大学的ACM竞赛题库. USACO ht ...

随机推荐

  1. 使用Retrofit和RxJava

    使用Retrofit和RxJava整合访问网络,然后将数据显示到界面上 def retrofitVersion = '2.0.0-beta1' dependencies { compile fileT ...

  2. iOS 一招搞定去掉字符串开始的0,尤其是针对时间格式化

    // 2.利用整型自动去掉开头的0, 不要循环和判断prefix以及截取字符串- (NSString *)pp_formatDateWithArrYMDToMD;{    NSInteger mont ...

  3. 2016大连网络赛 Function

    Function Time Limit: 7000/3500 MS (Java/Others)    Memory Limit: 262144/262144 K (Java/Others) Probl ...

  4. 搭建App主流框架_纯代码搭建(OC)

    转载自:http://my.oschina.net/hejunbinlan/blog/529778?fromerr=EmSuX7PR 搭建主流框架界面 源码地址在文章末尾 达成效果 效果图 注:本文部 ...

  5. error=11, Resource temporarily unavailable

    问题1:Cannot run program "/bin/ls": error=11, Resource temporarily unavailable 1 15/04/22 14 ...

  6. hadoop Yarn运行机制

  7. USACO1.3.4 Combination Lock

    题目链接:1.3.4 为了防止有重复的数字,我开了个三维数组来标记,爆内存,又用vector标记,爆内存... 不得不感慨这份代码. /* ID:wang9621 PROG:combo LANG:C+ ...

  8. ICE异步程序设计-----AMI/AMD

    1 简介 AMI 异步方法调用(AMI) 这个术语描述的是客户端的异步编程模型支持. 如果你使用AMI 发出远地调用,在Ice run time 等待答复的同时,发出调用的线程不会阻塞.相反,发出调用 ...

  9. PAT (Advanced Level) 1022. Digital Library (30)

    简单模拟题. 写的时候注意一些小优化,小心TLE. #include<iostream> #include<cstring> #include<cmath> #in ...

  10. PAT (Advanced Level) 1021. Deepest Root (25)

    先并查集判断连通性,然后暴力每个点作为根节点判即可. #include<iostream> #include<cstring> #include<cmath> #i ...