(简单dp 水过) poj 1887 Testing the CATCHER

Pku acm 第1887题 Testing the CATCHER 代码,有详细的注释 Pku acm 第1887题 Testing the CATCHER 代码,有详细的注释,动态规划 立即下载
Testing the CATCHER
Time Limit: 1000MS Memory Limit: 30000K
Total Submissions: 8793 Accepted: 3139

Description

A military contractor for the Department of Defense has just completed a series of preliminary tests for a new defensive missile called the CATCHER which is capable of intercepting multiple incoming offensive missiles. The CATCHER is supposed to be a remarkable defensive missile. It can move forward, laterally, and downward at very fast speeds, and it can intercept an offensive missile without being damaged. But it does have one major flaw. Although it can be fired to reach any initial elevation, it has no power to move higher than the last missile that it has intercepted.

The tests which the contractor completed were computer simulations of battlefield and hostile attack conditions. Since they were only preliminary, the simulations tested only the CATCHER's vertical movement capability. In each simulation, the CATCHER was fired at a sequence of offensive missiles which were incoming at fixed time intervals. The only information available to the CATCHER for each incoming missile was its height at the point it could be intercepted and where it appeared in the sequence of missiles. Each incoming missile for a test run is represented in the sequence only once.

The result of each test is reported as the sequence of incoming missiles and the total number of those missiles that are intercepted by the CATCHER in that test.

The General Accounting Office wants to be sure that the simulation test results submitted by the military contractor are attainable, given the constraints of the CATCHER. You must write a program that takes input data representing the pattern of incoming missiles for several different tests and outputs the maximum numbers of missiles that the CATCHER can intercept for those tests. For any incoming missile in a test, the CATCHER is able to intercept it if and only if it satisfies one of these two conditions:

The incoming missile is the first missile to be intercepted in this test.
-or-
The missile was fired after the last missile that was intercepted and it is not higher than the last missile which was intercepted.

Input

The input data for any test consists of a sequence of one or more non-negative integers, all of which are less than or equal to 32,767, representing the heights of the incoming missiles (the test pattern). The last number in each sequence is -1, which signifies the end of data for that particular test and is not considered to represent a missile height. The end of data for the entire input is the number -1 as the first value in a test; it is not considered to be a separate test.

Output

Output for each test consists of a test number (Test #1, Test #2, etc.) and the maximum number of incoming missiles that the CATCHER could possibly intercept for the test. That maximum number appears after an identifying message. There must be at least one blank line between output for successive data sets.

Note: The number of missiles for any given test is not limited. If your solution is based on an inefficient algorithm, it may not execute in the allotted time.

Sample Input

38920715530029917015865-1233421-1-1

Sample Output

Test #1:  
maximum possible interceptions: 6
Test #2:  
maximum possible interceptions: 2
 
电磁炉线圈加热仿真全流程:用Ansys Maxwell分析涡流效应与热损耗 本文详细介绍了使用Ansys Maxwell进行电磁炉线圈加热仿真的全流程。通过构建2D轴对称涡流场模型,深入分析了高频下的涡流效应、趋肤效应与热损耗分布,为优化线圈设计、提升加热效率与均匀性提供了量化依据和实用指南。 阅读详情

相关推荐

FPGA时序约束--实战篇(读懂Vivado时序报告)

本文将详细介绍如何读懂Vivado时序报告,包括报告的基本结构和如何分析报告。

mengzaishenqiu的博客 1万+

poj 1887Testing the CATCHER(最长下降子序列)

令我很无语,这道题…… Testing the CATCHER Time Limit: 1000MS   Memory Limit: 30000K Total Submissions: 10919   Accepted: 3951

tanhaiyuan 779

sift、surf、orb 特征提取——三维重建

参考文章:[sift、surf、orb 特征提取及最优特征点匹配] 最近刚刚入门三维重建,在SFM算法的代码中注意到了feature_type( feature extraction method)这个参数,想细致了解一下这几种特征提取算法,在这里做一下笔记。 SIFT 简介 SIFT(Scale-Invariant Feature Transform)——尺度不变特征变换,是一种计算机视觉的特征提取算法,用来侦测与描述图像中的局部特征。 实质上,它是在不同的尺度空间上查找关键点(特征点),并计算出关键点的

bb_sy_w的博客 4362

VirtualLab Fusion衍射角计算器原理与应用指南

衍射是光学系统中的基础物理现象,其角度计算直接影响成像质量和光路设计。通过衍射方程mλ = d(sinθm - sinθi)可理论计算衍射角,但实际工程中需考虑材料色散、温度效应等复杂因素。VirtualLab Fusion的衍射角计算器集成了多物理场耦合算法,支持从基础单缝衍射到复杂体全息光栅的自动化计算,大幅提升微纳光学元件设计和光谱仪开发的效率。该工具特别适用于AR衍射光波导设计等需要精确控制多级衍射角的应用场景,通过与光学设计模块的无缝集成,实现从理论计算到工程验证的完整工作流。

weixin_34236869的博客 230

虚拟机扩容——非LVM分区

虚拟机扩容——非LVM分区

ytraister的博客 3905

从零到一:QT for OpenHarmony 开发环境实战搭建与踩坑指南

本文是一份详尽的QT for OpenHarmony开发环境搭建实战指南。文章手把手教你如何在Windows和macOS系统上,从环境准备、核心工具(DevEco Studio与社区版QT SDK)安装配置,到创建首个QT Quick项目、解决构建部署中的常见问题,最终实现应用在OpenHarmony设备上运行。内容涵盖关键配置修改、资源管理及深度踩坑经验,旨在帮助开发者高效开启跨平台开发之旅。

weixin_29190573的博客 325

Testing the CATCHER (P1887)

题上说得比较复杂,可其意就是求最大降序列,不能相等。 这个题中要取最大值,而不是最后一个值。今天是第二次犯这样的错了。 这个数据比较弱,用O(n*n)的时间就可以无压力地过。 #include #include #include #include #include #include #include #include #include #include #incl

jiangjiashi的博客 638

主流算力卡性能对比分析

超大规模AI训练/HPC:优先选择NVIDIA H100或AMD MI300X,需关注显存带宽和多卡互联能力。企业级AI训练:NVIDIA A100性价比更高,生态成熟。国内自主可控需求:华为昇腾910B是首选,支持液冷和低功耗设计。本地AI推理/游戏:NVIDIA RTX 4090或RTX 5090性价比突出,但需注意显存容量限制。边缘计算/低功耗场景:华为昇腾310或清微智能TX536(能效比6.3TOPS/W@INT8)更合适。

m0_69867914的博客 7795

POJ-1887-Testing the CATCHER【最长不上升子序列nlogn】

Testing the CATCHER

Linoy 1029

MFC Tab Control控件完全指南:从基础使用到高级定制

本文详细介绍了MFC中TabControl控件的使用方法和高级技巧。主要内容包括:1) TabControl基础属性设置与绑定;2) 样式定制和外观自定义;3) 创建派生类实现扩展功能;4) 动态页面管理和子对话框控制;5) 高级功能如标签拖拽排序和右键菜单。通过完整代码示例,展示了从基本应用到复杂场景的实现方案,包括多标签页管理、自定义绘制、动态添加/删除标签等核心功能,为MFC开发者提供了全面的TabControl开发指南。

专注现代C++实战,从核心语法到高性能编程,助力开发者深入掌握系统级编程精髓。 257

SAR图像去斑(Despeckling)研究的主流开源数据集

这些数据集专门用于训练监督学习去斑模型,提供了配对的含斑SAR图像和对应的无噪声参考图像(Ground Truth)。这些数据集主要用于目标检测/识别,但包含原始SAR图像,可用于。由于缺乏真实无噪声SAR图像,许多研究采用。

VectorShift的博客 128

POJ 1887 Testing the CATCHER

题目大意:         一国防部的军火承包商刚刚完成了一系列关于防御性导弹“捕猎者”的初步测试,该导弹具有一次性拦截多枚来袭导弹的能力,它被期望为一种非凡的防御武器,它可以告诉前行、侧行、下行,并且拦截导弹时不会自毁(即不是直接撞击来袭导弹),因此可以连续拦截多枚导弹,但它还有一个缺陷,它不能再移动到比上次拦截导弹更高的位置,但是它的初始攻击位置可以为任意高。         该项测试是由

源代码 1287

基于FMU的Star CCM+与Amesim复杂控制联合分析

基于FMU的Star CCM+与Amesim复杂控制联合分析

2201_75375391的博客 2016

poj 1887 Testing the CATCHER 最长不升子序列

最长不升子序列

凌风 1975

WINCC7.3破解文件

WINCC7.3硬件够破解文件,有需要的下载!WINCC7.3硬件够破解文件,有需要的下载!

Data-Structures-and-Algorithm-Analysis-in-Java.pdf

作者: Weiss, Mark A. 出版社: Addison Wesley Data Structures and Algorithm Analysis in Java is an “advanced algorithms” book that fits between traditional CS2 and Algorithms Analysis courses. In the old ACM Curriculum Guidelines, this course was known as CS7. This text is for readers who want to learn good programming and algorithm analysis skills simultaneously so that they can develop such programs with the maximum amo...

POJ 1887-Testing the CATCHER(dp_最长下降子序列)

Testing the CATCHER Time Limit: 1000MS   Memory Limit: 30000K Total Submissions: 15382   Accepted: 5657 Description A military contractor for the Department of Defens

Rocky0429 985

廖雪峰Python教程[完整版]

廖雪峰的python教程整理的,已经排好版了,而且还是完整的,适合小白

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

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

Dacc123的博客 555

VC中sqlite的使用

在VC中对sqlite的使用,实现数据库大批数据的快速插入,读取数据库中的数据在ListCtrl中显示

POJ 1887 —— Testing the CATCHER 最长下降子序列

原题:http://poj.org/problem?id=1887 求最长下降子序列个数 注意输出格式! O(n²) #include #include using namespace std; int dp[100000000]; int a[100000000]; int cas = 0; int main() { int tmp; while(~scanf("%d",

0x3f3f3f3f 884

POJ--1887:Testing the CATCHER (DP求最长非递增子序列)

1. 题目源地址:http://poj.org/problem?id=1887 2.

酒酿小圆子呀~ 907

POJ1887 Testing the CATCHER

要点: 1.即求最大下降子序列,可以直接将数组倒过来用求最大上升子序列的算法 2.如何用-1结束程序一开始没理解,题意就是每组开始时如果第一个输入的是-1就跳出 3.这题数据比较水,用n^2的也能过,不过为了充分理解我把两种都写一遍一:O(n^2)#include<stdio.h> int main() { int a[50000],dp[50000]; int i, j

SeasonJoe的博客 578

poj1887 - Testing the CATCHER(动归)

最长不上升子序列。 把最长上升子序列的代码稍微改动一下即可 详解请见:http://wenku.baidu.com/view/fe0deecea1c7aa00b52acb71.html #include #include #define N 10005 int n, a[N], c[N], dp[N]; int search(int l, int r, int x) { int

稻草人 839

POJ 1887 Testing the CATCHER G++

#include <iostream> #include <map> #include <algorithm> using namespace std; map<int,int> dp; int main() { int flag=0; int tag=0; while(1) { tag++; int jg=0; d...

woniupengpeng的专栏 186

poj 1887 Testing the CATCHER

<br />题意:这道题目就是求最长的上升序列。<br />思路:dp,貌似是比较简单的dp。注意结果不一定是dp[n-1].<br />代码:<br />#include <iostream> using namespace std; int a[10000]; int dp[10000]; int main() { int x; int cishu = 1; while(scanf("%d",&x), x!= -1) { int n = 0 ; a[n] =

kyou007的专栏 570

POJ 1887 Testing the CATCHER 经典DP

来源:http://poj.org/problem?id=1887 题意:求最长递减子序列 思路:用dp[i]表示前i个数的最长递减子序列,则dp[i] = max(dp[j]) + 1,其中,i>j 且 num[i]   代码: #include #include #include using namespace std; #define CLR(arr,val) memset(

900

Poj 1887 Testing the CATCHER

题目大意:求给定数列的最长不升子序列。 思路:比较水的DP,数组data存储给定的数列,dp[i]表示以data[i]结尾的最长不升子序列的长度。状态转移方程为if (data[j]>=data[i]&&dp[j]>=dp[i])dp[i]=dp[j]+1;(0 #include int data[5000]; int dp[5000]; int main() { int t,i,j,

Detective_Xin的专栏 550
上一篇: (匈牙利算法) 小狗散步
下一篇: (二分+dp) poj 1631 Bridging signals
Hashmat
博客等级 码龄16年 14粉丝 62原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值