#include<iostream>
using namespace std ;
const int N=;
int f[N];
int a[N];
int main() {
int n;
cin>>n;
int res=;
for(int i=; i<=n; i++) cin>>a[i];
for(int i=; i<=n; i++) {
f[i]=a[i];
for(int j=; j<i; j++) {
if(a[i]>a[j]) f[i]=max(f[i],f[j]+a[i]);
}
res=max(res,f[i]);
}
cout<<res<<endl;
return ;
}

AcWing 1016. 最大上升子序列和的更多相关文章

  1. AcWing 799. 最长连续不重复子序列

    网址  https://www.acwing.com/solution/AcWing/content/2069/ 题目描述给定一个长度为n的整数序列,请找出最长的不包含重复数字的连续子序列,输出它的长 ...

  2. AcWing 272. 最长公共上升子序列

    #include<iostream> using namespace std ; ; int n; int a[N]; int b[N]; int f[N][N]; //f[i][j] / ...

  3. AcWing 799. 最长连续不重复子序列 双指针(一般先写一个朴素暴力的做法,然后看两个指针直接是否存在单调关系,如果存在,就想方法优化)

    https://www.acwing.com/problem/content/801/ #include<bits/stdc++.h> using namespace std ; int ...

  4. AcWing 896. 最长上升子序列 II

    #include<iostream> #include<algorithm> #include<vector> using namespace std; int m ...

  5. AcWing 895. 最长上升子序列

    //设上升序列的最后一个数字为第i个,那么就以第i-1个位分类标准, //i-1可以没有,也可以是在数组中下标为1,下标为2 //一直到下标为i-1的数字 #include <iostream& ...

  6. AcWing 897. 最长公共子序列

    #include <iostream> #include <algorithm> using namespace std; ; int n, m; char a[N], b[N ...

  7. [AcWing 2816] 判断子序列

    点击查看代码 #include<iostream> using namespace std; const int N = 1e5 + 10; int a[N], b[N]; int mai ...

  8. [AcWIng 799] 最长连续不重复子序列

    点击查看代码 #include<iostream> using namespace std; const int N = 1e5 + 10; int a[N], s[N]; int mai ...

  9. AcWing 314. 低买 (线性DP)打卡

    题目:https://www.acwing.com/problem/content/316/ 题意:求一个最长单调递减子序列,然后并且求方案数,如果序列完全一样就不要了 思路:我们肯定时修改LIS,我 ...

随机推荐

  1. Java Web 笔记(4)

    11.Filter (重点) Filter:过滤器 ,用来过滤网站的数据: 处理中文乱码 登录验证-. Filter开发步骤: 导包 编写过滤器 导包不要错 实现Filter接口,重写对应的方法即可 ...

  2. Angular2的环境构筑

    1.nodejs安装   https://nodejs.org/en/download/   2.环境变量设定   Path->\node-v10.16.3-win-x64   3.在cmd下输 ...

  3. 纪中10日T1 2313. 动态仙人掌

    纪中10日 2313. 动态仙人掌 (File IO): input:dinosaur.in output:dinosaur.out 时间限制: 1500 ms  空间限制: 524288 KB  具 ...

  4. Codeforces Round #599 (Div. 2) D. 0-1 MST(bfs+set)

    Codeforces Round #599 (Div. 2) D. 0-1 MST Description Ujan has a lot of useless stuff in his drawers ...

  5. Case Study - 用户复购行为预测

    Problem 对于商家来说提前识别回头客是一件集中资源提高新品销售量的头等大事,各大商家为了吸引顾客的二次购买都会实行各种像是促销.优惠券.折扣之类的策略.按理说越了解客户,越知道客户的喜好,越能精 ...

  6. 理财收益的计算 计算浮点数的n次方 1466

    题目描述 老傻非常喜欢购买理财产品,而且这款理财产品被推销人员吹得特别高,对于贪财的老傻来说正中下怀,于是在心里盘算着买了它,自己就是亿万富豪,现需要你编写一个程序,帮老傻计算其收益,老傻的投入是R( ...

  7. windows系统安装Java(详细版)

    1.下载JDK 官网下载: www.oracle.com/technetwork… 百度云下载: pan.baidu.com/s/1LGf3Podz…提取码:s6mg (官网下载步骤) 进入官网 ht ...

  8. centos7安装显示中文

    系统通过环境变量LANG设置语言格式编码 查看当前语言环境 echo $LANG 查看是否安装中文语言,Linux中通过locale来设置程序运行的不同语言环境 locale -a | grep 'z ...

  9. 剑指offer-面试题23-链表中环的入口节点-双指针

    /* 题目: 如果链表中包含环,如何找出环的入口? */ /* 思路: 双指针: 1.判断是否有环. fast指针一次2步,slow指针一次1步,当fast与slow相遇时,说明有环. 2.判断环路中 ...

  10. 畅通工程 HDU - 1232 并查集板子题

    #include<iostream> #include<cstring> using namespace std; ; int p[N]; int find(int x) { ...