HDU-1257 导弹拦截系统 http://acm.hdu.edu.cn/showproblem.php?pid=1257
怎么办呢?多搞几套系统呗!你说说倒蛮容易,成本呢?成本是个大问题啊.所以俺就到这里来求救了,请帮助计算一下最少需要多少套拦截系统.
#include<cstdio>
#include<cstring>
#include<iostream>
#include<cmath>
#include<algorithm>
#define N 100010
using namespace std;
int a[N], b[N], ans;
int main()
{
int n;
while(~scanf("%d",&n))
{
memset(a, , sizeof(a));
memset(b, , sizeof(b));
ans = ;
for (int i = ; i < n; i++)
{
scanf ("%d", &a[i]);
for (int j = ; j <= ans; j++)
{
if (a[i] < b[j])
{
b[j] = a[i];
break;
}
else if (j == ans)
{
b[++ans] = a[i];
break;
}
}
sort(b+, b+ans);
}
printf("%d\n", ans);
}
return ;
}
HDU-1257 导弹拦截系统 http://acm.hdu.edu.cn/showproblem.php?pid=1257的更多相关文章
- (hdu)1257 最少拦截系统
题目链接:http://acm.split.hdu.edu.cn/showproblem.php?pid=1257 Problem Description 某国为了防御敌国的导弹袭击,发展出一种导弹拦 ...
- HDU 1257 最少拦截系统(贪心 or LIS)
题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=1257 最少拦截系统 Time Limit: 2000/1000 MS (Java/Others) ...
- hdu 1257 最少拦截系统【贪心 || DP——LIS】
链接: http://acm.hdu.edu.cn/showproblem.php?pid=1257 http://acm.hust.edu.cn/vjudge/contest/view.action ...
- 题解报告:hdu 1257 最少拦截系统(贪心)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1257 Problem Description 某国为了防御敌国的导弹袭击,发展出一种导弹拦截系统.但是 ...
- HDU 1257最少拦截系统[动态规划]
传送门:http://acm.hdu.edu.cn/showproblem.php?pid=1257 最 ...
- hdu 1257 最少拦截系统(简单贪心)
题目:http://acm.hdu.edu.cn/showproblem.php?pid=1257 虽然分类是dp感觉还是贪心 比较水 #include <iostream> #inclu ...
- HDU 1257 最少拦截系统(最长递减子序列的条数)
题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=1257 题解: #include<iostream> #include<cstdio ...
- HDU I-最少拦截系统
http://acm.hdu.edu.cn/showproblem.php?pid=1257 Problem Description 某国为了防御敌国的导弹袭击,发展出一种导弹拦截系统.但是这种导弹拦 ...
- 【HDUOJ】1257 最少拦截系统
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1257 题意:经典题. 题解:最长上升子序列. 代码: #include <iostream> ...
随机推荐
- PHPExcel——读取excel
在网上找了excel读取的一些资料,个人觉得PHPExcel这还是挺好用的,相对比较全的工具. 主要功能是读取上传的excel文件,插入或更新到数据库. iconv("gbk",& ...
- T-SQL Recipes之删除重复行
准备基础数据 (1)创建辅助表,方便以后倾向于Set-base方式解决问题 -- Creating and Populating the Nums Auxiliary Table SET NOCOUN ...
- CSS:在IE浏览器下,元素下沉一行的解决办法
HTML: <ul> <li><a href="">嘻嘻嘻嘻嘻嘻</a><span>2015-12-17</spa ...
- 《Storm入门》中文版
本文翻译自<Getting Started With Storm>译者:吴京润 编辑:郭蕾 方腾飞 本书的译文仅限于学习和研究之用,没有原作者和译者的授权不能用于商业用途. 译者序 ...
- RCurl getURL()函数做debug
getURL()函数做获取网页做debug,三步骤 1.首先创建一个对象debugGatherer(),该对象包含三个函数:(update(), value(), reset()); R> de ...
- java命令行引入jar包
编译: E:/>javac -cp e:/jdom.jar test1.java 执行: E:/>java -classpath e:/jdom.jar; test1
- CI框架入门2
文件目录与布局 1.user_guide 用户手册,可删 2.readme.rst 说明,可删 3.license.txt 证书,可删 4..gitignore composer. ...
- EMF学习,为了实现可扩展可自定义的模型验证 - 各种实现方法学习
自: http://blog.csdn.net/javaman_chen/article/details/6057033 http://www.ibm.com/developerworks/cn/op ...
- Sublime Text 3 杂记
Sublime Text 是一个功能强大的代码编辑器(收费,但可无限期试用).由程序员Jon Skinner于2008年1月份所开发出来,它最初被设计为一个具有丰富扩展功能的Vim.Sublime T ...
- angular前端开发环境
1.代码编辑工具 webstorm 2.断点调试工具 chrome插件Batarang 3.版本管理工具 git(仅仅是命令行工具) git小乌龟--tortoisegit(图形化工具) 首先在git ...