题目链接:

http://acm.hdu.edu.cn/showproblem.php?pid=1257

题解:

 #include<iostream>
#include<cstdio>
using namespace std; const int maxn = + ; int dp[maxn],arr[maxn];
int n; int main() {
while (scanf("%d", &n) == && n) {
for (int i = ; i < n; i++) {
scanf("%d", arr + i);
}
int ans = ;
dp[ans++] = arr[];
for (int i = ; i < n; i++) {
int su = ;
//dp数组是递增的!
for (int j = ; j < ans; j++) {
if (dp[j] >= arr[i]) {
dp[j] = arr[i];
su = ; break;
}
}
if (!su) {
dp[ans++] = arr[i];
}
}
printf("%d\n", ans);
}
return ;
}

HDU 1257 最少拦截系统(最长递减子序列的条数)的更多相关文章

  1. HDU 1257 最少拦截系统 最长递增子序列

    HDU 1257 最少拦截系统 最长递增子序列 题意 这个题的意思是说给你\(n\)个数,让你找到他最长的并且递增的子序列\((LIS)\).这里和最长公共子序列一样\((LCS)\)一样,子序列只要 ...

  2. hdu 1257 最少拦截系统 求连续递减子序列个数 (理解二分)

    最少拦截系统 Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Subm ...

  3. HDU 1257 最少拦截系统(贪心 or LIS)

    题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=1257 最少拦截系统 Time Limit: 2000/1000 MS (Java/Others)   ...

  4. HDU 1257最少拦截系统[动态规划]

    传送门:http://acm.hdu.edu.cn/showproblem.php?pid=1257                                                 最 ...

  5. POJ - 2533 Longest Ordered Subsequence与HDU - 1257 最少拦截系统 DP+贪心(最长上升子序列及最少序列个数)(LIS)

    Longest Ordered Subsequence A numeric sequence of ai is ordered if a1 < a2 < ... < aN. Let ...

  6. HDU 1257 最少拦截系统【最长上升子序列】

    解题思路:可以转化为求最长上升子序列来做,还是可以用an与按升序排列后的an求LCS来做,为防止超时,用滚动数组优化一下就可以了. 最少拦截系统 Time Limit: 2000/1000 MS (J ...

  7. HDU 1257 最少拦截系统(Dilworth定理+LIS)

    最少拦截系统 Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Sub ...

  8. hdu 1257 最少拦截系统【贪心 || DP——LIS】

    链接: http://acm.hdu.edu.cn/showproblem.php?pid=1257 http://acm.hust.edu.cn/vjudge/contest/view.action ...

  9. HDU 1257——最少拦截系统——————【LIS变型题】

    最少拦截系统 Time Limit:1000MS     Memory Limit:32768KB     64bit IO Format:%I64d & %I64u Submit Statu ...

  10. HDU 1257 最少拦截系统 (DP || 贪心)

    最少拦截系统 Time Limit:1000MS     Memory Limit:32768KB     64bit IO Format:%I64d & %I64u Submit Statu ...

随机推荐

  1. mybatis xml文件 -- 报错 invalid comparison: java.time.LocalDateTime and java.lang.String

    原配置写法:<if test="assetFlaw.handleTime != null and assetFlaw.handleTime != ''"> and af ...

  2. Redis(二):Redis入门介绍

    Redis入门介绍目录导航: 入门概述 VMWare + VMTools千里之行始于足下 Redis的安装 Redis启动后杂项基础知识讲解 入门概述 是什么 Redis:REmote DIction ...

  3. mysql主键重复,不抱错,只更新的骚操作 (如果没有插入,如果有更新)

    平时我们在设计数据库表的时候总会设计 unique  或者 给表加上 primary key 的限制条件. 此时 插入数据的时候 ,经常会有这样的情况: 我们想向数据库插入一条记录: 若数据表中存在以 ...

  4. Linux入门——基础系统设置命令

    以下为centos7实验环境 1.网卡管理工具命令——nmcli 参考:http://www.iteye.com/topic/1141839 2.主机名称设置——hostnamectl [root@s ...

  5. 20155305《信息安全系统设计基础》10月18日课堂 fork,exic,wait

    20155305<信息安全系统设计基础>10月18日课堂 fork,exic,wait fork()函数 1.fork函数作用 一般来讲, 我们编写1个普通的c程序, 运行这个程序直到程序 ...

  6. 【课堂实践】Myod

    实验内容 编写MyOD.java 用java MyOD XXX实现Linux下od -tx -tc XXX的功能 实验代码 od.java 截图 遇到的问题及解决办法 一开始想的方向是将得出的功能结果 ...

  7. 20155321 2016-2017-2《Java程序设计》课程总结

    20155321 2016-2017-2<Java程序设计>课程总结 每周作业链接汇总 预备作业1:我期望的师生关系 预备作业2:学习情况的相关调查 预备作业3:安装虚拟机以及学习Linu ...

  8. 20155334 2016-2017-2 《Java程序设计》第二周学习总结

    20155334 2016-2017-2 <Java程序设计>第二周学习总结 教材学习内容总结 java中的基本类型 整数:有short.int.long三种 字节:byte 字符:cha ...

  9. echarts 拐点添加图片

    series : [ { name:'搜索引擎', type:'line', symbol:'emptyCircle', symbolSize: 5, itemStyle: { normal: { l ...

  10. Using Xpath With Default XML Namespace in C#

    If you have a XML file without any prefix in the namespace: <bookstore xmlns="http://www.con ...