拦截导弹 poj
来源:互联网 发布:阿里云信任付怎么还款 编辑:程序博客网 时间:2024/05/21 08:49
dp法。一维。maxint[i]表示到第i颗导弹为止最多拦截的导弹数目。
技巧:temp
#include <iostream>#include <cmath>#include <climits>#include <string>#include <cctype>#include <vector>#include <cmath>#include <cstring>#include <array> #include <algorithm>using namespace std;int maxint[2000];int b[2000];int main(){ int i,j,n,k; cin>>n; for(i=1;i<=n;i++){ cin>>b[i]; } maxint[1]=1; for(i=1;i<=n;i++){ int temp=0; for(j=1;j<i;j++){ if(b[i]<=b[j]){ if(temp<maxint[j]) temp=maxint[j]; } } maxint[i]=temp+1; } int max=-1; for(i=1;i<=n;i++){ if(maxint[i]>max) max=maxint[i]; } cout<<max;}
0 0
- poj-2945:拦截导弹
- POJ 8780 拦截导弹
- 拦截导弹 poj
- 拦截导弹
- 拦截导弹
- 拦截导弹
- 拦截导弹
- 导弹拦截
- 导弹拦截
- 拦截导弹
- 拦截导弹
- 拦截导弹
- 拦截导弹
- 拦截导弹
- 拦截导弹
- 拦截导弹
- 拦截导弹
- 拦截导弹
- CPP_Basic_Code_P5.1-PP5.9.10
- 考试(2017年3月26日) (COCI)
- Web Hacking 101 中文版 十一、SQL 注入
- Python矩阵计算
- SecureCRT自动保存日志设置
- 拦截导弹 poj
- centos7 安装mysql(解压缩版)
- android内存优化知识
- Google TODO-MVP-Loaders 简要分析
- Java WebService 简单实例、调用第三方提供的WebService服务
- 模板函数的定义问题
- 南阳oj-58 最少步数
- sudo apt-get autoremove系统崩溃
- C++ allocators将构造函数,析构函数与分配内存解耦