【HDUOJ】1257 最少拦截系统
题目链接: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 最少拦截系统的更多相关文章
- HDU 1257 最少拦截系统(贪心 or LIS)
题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=1257 最少拦截系统 Time Limit: 2000/1000 MS (Java/Others) ...
- HDOJ 1257 最少拦截系统 【DP】
HDOJ 1257 最少拦截系统 [DP] Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Other ...
- HDU 1257 最少拦截系统 最长递增子序列
HDU 1257 最少拦截系统 最长递增子序列 题意 这个题的意思是说给你\(n\)个数,让你找到他最长的并且递增的子序列\((LIS)\).这里和最长公共子序列一样\((LCS)\)一样,子序列只要 ...
- HDU 1257最少拦截系统[动态规划]
传送门:http://acm.hdu.edu.cn/showproblem.php?pid=1257 最 ...
- HDU 1257 最少拦截系统(Dilworth定理+LIS)
最少拦截系统 Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Sub ...
- HDU 1257 最少拦截系统 (DP || 贪心)
最少拦截系统 Time Limit:1000MS Memory Limit:32768KB 64bit IO Format:%I64d & %I64u Submit Statu ...
- HDOJ.1257 最少拦截系统 (贪心)
最少拦截系统 点我挑战题目 题意分析 一开始理解错了这道题.这么多个导弹排好序不只需要1个拦截系统吗.后来发现自己真傻.那出这个题还有啥意思,反正都需要一个.(:′⌒`) 给出n个导弹,这n个导弹的顺 ...
- hdu 1257 最少拦截系统【贪心 || DP——LIS】
链接: http://acm.hdu.edu.cn/showproblem.php?pid=1257 http://acm.hust.edu.cn/vjudge/contest/view.action ...
- HDU 1257——最少拦截系统——————【LIS变型题】
最少拦截系统 Time Limit:1000MS Memory Limit:32768KB 64bit IO Format:%I64d & %I64u Submit Statu ...
- hdoj 1257 最少拦截系统
最少拦截系统 Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Subm ...
随机推荐
- jQuery选择器中空格的问题再探究
jQuery选择器的空格问题,看似很小,但是差之毫厘谬以千里,让人很是恼火,<锋利的jQuery>书中有个经典的例子,我这里也拷贝下来,再加点自己的想法 <html> < ...
- Cai_Sublime
Cai_Sublime Package Control:插件包管理工具 The simplest method of installation is through the Sublime Text ...
- CG-CTF CRYPTO部分wp
1,easybase64解密得flag 2,keyboard键盘码,在键盘上画画得flag:areuhack 3,异性相吸根据提示,写脚本 with open('密文.txt')as a: a=a.r ...
- 第三章 k8s的node节点配置
一.修改主机名 hostnamectl set-hostname xxx 二.修改hosts文件vim /etc/hosts 三.将写好的hosts文件拷贝到其他节点 scp /etc/hosts r ...
- CICS FILE OPEN
CEMT I CECD V FILE() GROUP() CEDA check error log in JESYSMSG FILE OPEN/CLOSE STATUS CICS ACTION res ...
- Redux DevTools Extension 的使用
网址 https://github.com/zalmoxisus/redux-devtools-extension 1.const composeEnhancers = window.__REDUX ...
- mysql查找字段空、不为空的方法总结
1.不为空 Select * From table_name Where id<>'' Select * From table_name Where id!='' 2.为空 Select ...
- webpack引入全局jQuery
1.使用命令行npm install jquery来安装jQuery 2.在webpack.config.js文件里配置: plugins:[ new webpack.ProvidePlugin({ ...
- qt中使用sqlite存储数据
一.sqilte的安装 在Windows上安装SQLite: 请访问 SQLite 下载页面,从 Windows 区下载预编译的二进制文件. 您需要下载 sqlite-tools-win32-*.zi ...
- bzoj4403题解
[参考代码] #pragma GCC optimize(2) #include <cstdlib> #define function(type) __attribute__((optimi ...