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

  最长递减子序列问题。

 #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. arrayList里的快速失败

    快速失败是指某个线程在迭代集合类的时候,不允许其他线程修改该集合类的内容,这样迭代器迭代出来的结果就会不准确. 比如用iterator迭代collection的时候,iterator就是另外起的一个线 ...

  2. opencart配置United States Postal Service快递

    1.安装United States Postal Service 2.登录https://registration.shippingapis.com/,注册帐号,稍后会收到邮件 3.打开邮件,记下Us ...

  3. YII2 随笔 视图最佳实践

    yii\base\Controller::render(): 渲染一个 视图名 并使用一个 布局 返回到渲染结果. yii\base\Controller::renderPartial(): 渲染一个 ...

  4. 在web项目中使用cxf开发webservice,包含spring支持

    本文主要介绍了,如何使用cxf内置的例子,学会开发webserivce,在web项目中使用,且包含spring支持. webserivce的开发可以使用cxf或者axis,好像还有httpclient ...

  5. POJ 1821 单调队列+dp

    题目大意:有K个工人,有n个墙,现在要给墙涂色.然后每个工人坐在Si上,他能刷的最大范围是Li,且必须是一个连续子区间,而且必须过Si,他刷完后能获得Pi钱 思路:定义dp[i][j]表示前i个人,涂 ...

  6. bundle export fail

    C:\eclipse\eclipse.exe -vmargs -Dfile.encoding=utf8

  7. STM32|4-20mA输出电路

    源:STM32|4-20mA输出电路 为工业场合开发的设备通常情况下都会具有4-20mA输出接口,在以往没有DAC模块的单片机系统,需要外加一主片DAC实现模拟量的控制,或者采用PWM来摸拟DA,但也 ...

  8. Highcharts获取json数据展现pie饼图

    实际上很多时候图表展现的数据都是从服务器端获取,现在来做一个简单的异步获取json数据的例子. 服务器端用Servlet3.0实现,JSP页面通过jquery异步请求json数据提供给Highchar ...

  9. gridview中button事件处理

    http://msdn.microsoft.com/zh-cn/library/bb907626.aspx 再结合如下: protected void GridView1_RowCommand(obj ...

  10. Kubernetes 1.4 部署

    k8s 1.4 新版本部署 测试环境: node-: 10.6.0.140 node-: 10.6.0.187 node-: 10.6.0.188 kubernetes 集群,包含 master 节点 ...