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

  最长递减子序列问题。

 #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. Stem Cell 华人科学家

    Jianping Fu 密歇根大学机械工程系生物医学工程专业 PhD, Massachusetts Institute of Technology, 2007MS, University of Cal ...

  2. drawable文件夹详解

    QVGA使用ldpi,虽然有不同尺寸,但都是120dpi左右:HVGA同理:如下图: -finger    用于触摸屏的设备 -hdpi    近似于240dpi的高级显示密度的屏幕 -mdpi    ...

  3. mysql分页pagination

    http://www.phpjabbers.com/php--mysql-select-data-and-split-on-pages-php25.html returns 20 records so ...

  4. Android-----获取屏幕分辨率DisplayMetrics简介 .

    引自:http://blog.csdn.net/zhangqijie001/article/details/5894872 Android 可设置为随着窗口大小调整缩放比例,但即便如此,手机程序设计人 ...

  5. ZOJ 3939The Lucky Week<模拟/暴力>

    题意:我们认为日期的天数为1,11,21,并且是周一的为Lucky Week;现在给出第一个lucky week的日期,求第N个的lucky week: //1:四百年一轮回,从闰年和平年的判定可以推 ...

  6. 安卓布局修改基础常识篇之TextView属性

    [天使]安卓布局修改基础常识篇之TextView属性 在修改布局xml文件时需要熟练掌握一些属性,以下是TextView也就是文本的属性:android:autoLink 是否自动链接网址或邮箱地址: ...

  7. Hadoop 文本分类 终于跑通了

    Training 入口 package org.wordCount; import java.util.ArrayList; import java.util.List; import org.apa ...

  8. WEKA使用教程(经典教程转载)

    http://blog.csdn.net/yangliuy/article/details/7589306 WEKA使用教程(经典教程转载) 标签: lift算法csv数据挖掘class任务 2012 ...

  9. extjs最普通的grid

    的 <script> Ext.onReady(function () { //1.定义Model Ext.define("MyApp.model.User", { ex ...

  10. Struts2--Dynamic Result动态结果集

    ${r} : 表示配置文件xml可以读取action的valuestack的内容 1. jsp显示文件: <body> 动态结果 一定不要忘了为动态结果的保存值设置set get方法 &l ...