hdu 1257 最少拦截系统
#include<time.h>
#include <cstdio>
#include <iostream>
#include<algorithm>
#include<math.h>
#include <string.h>
#include<vector>
#include<queue>
using namespace std; int dp[][],num[],a[]; int main()
{
int n;
while(scanf("%d",&n)!=EOF)
{
for(int i=;i<n;i++)
{
scanf("%d",&a[i]);
num[i]=a[i];
} sort(a,a+n);
dp[][]=;
for(int i=;i<n;i++)
for(int j=;j<n;j++)
{
if(a[i]==num[j])
dp[i+][j+]=dp[i][j]+;
else
dp[i+][j+]=max(dp[i+][j],dp[i][j+]);
}
printf("%d\n",dp[n][n]);
}
return ;
}
hdu 1257 最少拦截系统的更多相关文章
- HDU 1257 最少拦截系统 最长递增子序列
HDU 1257 最少拦截系统 最长递增子序列 题意 这个题的意思是说给你\(n\)个数,让你找到他最长的并且递增的子序列\((LIS)\).这里和最长公共子序列一样\((LCS)\)一样,子序列只要 ...
- HDU 1257 最少拦截系统(贪心 or LIS)
题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=1257 最少拦截系统 Time Limit: 2000/1000 MS (Java/Others) ...
- 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 ...
- 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 ...
- hdu 1257 最少拦截系统(动态规划 / 贪心)
最少拦截系统 Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Subm ...
- hdu 1257最少拦截系统
最少拦截系统 某国为了防御敌国的导弹袭击,发展出一种导弹拦截系统.但是这种导弹拦截系统有一个缺陷:虽然它的第一发炮弹能够到达任意的高度,但是以后每一发炮弹都不能超过前一发的高度.某天,雷达捕捉到敌国的 ...
- POJ - 2533 Longest Ordered Subsequence与HDU - 1257 最少拦截系统 DP+贪心(最长上升子序列及最少序列个数)(LIS)
Longest Ordered Subsequence A numeric sequence of ai is ordered if a1 < a2 < ... < aN. Let ...
随机推荐
- Android入门之GPS定位详解
一.LocationManager LocationMangager,位置管理器.要想操作定位相关设备,必须先定义个LocationManager. LocationManger locationMa ...
- Effective Java 读书笔记之五 枚举和注解
Java1.5中引入了两个新的应用类型家族,新的类为枚举类型,新的接口为注解类型. 一.用enum代替int常量 1.枚举值由一组固定的常量组成合法值的类型. 二.用实例域代替序数 1.不要根据枚举的 ...
- HLOI2016滚粗记
首先,别问我HLOI是哪里....HLJ = 黑龙江... 这次的省选总结起来还是由于我太弱,考试的时候状态不好,连个线段树都没想出来 坐了好久的火车到哈尔滨,车上打了一会扑克,感觉没过多长时间就到了 ...
- html5拖拽实现
1.需求 做一个h5正方形的拖拽框 2.分析 使用touchstart,touchmove,touchend这3个事件实现. 需要记录的数据有三组数据,分别是下图的(x0,y0),(x1,y1),(x ...
- nginx 免安装包
在一个环境下编译安装好nginx,然后可以拷贝到其他环境使用.同时避免直接安装造成的环境冲突. 首先下载好nginx和相关插件.然后编译安装到沙盒里面.demo如下: cd到nginx目录 ./con ...
- Pairing heap
其实挺好写的...(大雾) 理性愉悦大法好... #include<cstdio> #include<algorithm> namespace utils{ template& ...
- VNC server grey screen under ubuntu 14.04
nstall these packages: apt-get install gnome-panel gnome-settings-daemon metacity nautilus gnome-ter ...
- Increasing Triplet Subsequence
Given an unsorted array return whether an increasing subsequence of length 3 exists or not in the ar ...
- cf592d
题意:给出一个无根树,点数为10^5,所有边的长度为1.给定其中有一些点是受到攻击的. 现在要求一个人选定一个点作为起点,走遍所有的受攻击点(不用再回到起点). 需要的最短距离是多少,选定的起点是哪个 ...
- Qt 使用sqlserver
1. pro 添加 QT +=sql 2. void MainWindow::connectSqlServer() { QSettings *setIni = new QSettings( ...