题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1257

题意:经典题。

题解:最长上升子序列。

代码:

 #include <iostream>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <string>
#define ll long long
using namespace std;
const int maxn = ; int a[maxn];
int dp[maxn];
int main(){
int n;
while(cin>>n){
for(int i = ; i <= n ;i++){
cin>>a[i];
dp[i] = ;
}
//转成上升
for(int i = ;i <= n; i++){
for(int j = ; j < i ;j++){
if(a[j] < a[i]){
dp[i] = max(dp[i],dp[j] + );
}
}
} int maxx = -; for(int i = ; i <= n ;i++)
maxx = max(dp[i],maxx);
cout<<maxx<<endl;
}
return ;
}

【HDUOJ】1257 最少拦截系统的更多相关文章

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

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

  2. HDOJ 1257 最少拦截系统 【DP】

    HDOJ 1257 最少拦截系统 [DP] Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Other ...

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

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

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

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

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

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

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

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

  7. HDOJ.1257 最少拦截系统 (贪心)

    最少拦截系统 点我挑战题目 题意分析 一开始理解错了这道题.这么多个导弹排好序不只需要1个拦截系统吗.后来发现自己真傻.那出这个题还有啥意思,反正都需要一个.(:′⌒`) 给出n个导弹,这n个导弹的顺 ...

  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. hdoj 1257 最少拦截系统

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

随机推荐

  1. CentOS 7 64位虚拟机安装过程

    第一步:新建一个虚拟机,选择典型安装,点击下一步.

  2. FrameWork内核解析之Handler消息机制(二)

    阿里P7Android高级架构进阶视频(内含Handler视频讲解)免费学习请点击:https://space.bilibili.com/474380680 一.Handler 在Android开发的 ...

  3. 在规定的时间内出现动画.html

    <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title> ...

  4. ACM_ICPC_Team

    题目: There are a number of people who will be attending ACM-ICPC World Finals. Each of them may be we ...

  5. Codeforces New Year and Arbitrary Arrangement

    New Year and Arbitrary Arrangement time limit per test2 seconds You are given three integers k, pa a ...

  6. css 两边是线,中间文字的多种实现方法

    <div class="soild_text_one"> <fieldset> <legend>历史活动一</legend> < ...

  7. MySQL数据库企业级应用实践(主从复制)

    MySQL数据库企业级应用实践(主从复制) 链接:https://pan.baidu.com/s/1ANGg3Kd_28BzQrA5ya17fQ 提取码:ekpy 复制这段内容后打开百度网盘手机App ...

  8. anyka安凯微电子

    http://www.anyka.com/   幼教机

  9. macOS添加字体

    打开macOS的Applications文件夹: 双击其中的Font Book: 把下载的字体解压后的_文件夹_ 拖进来,字体就安装好了.

  10. Java中的时间日期Date和Calendar

    日期时间类 Date: Date类的构造方法: 可以发现Date类的toString方法被重写了. Date类的方法: SimpleDateFormat 它提供了解决Date输出问题的解决方案--格式 ...