hdu 1087 最大递增子序列和
#include <bits/stdc++.h>
#define PI acos(-1.0)
#define mem(a,b) memset((a),b,sizeof(a))
#define TS printf("!!!\n")
#define pb push_back
//std::ios::sync_with_stdio(false);
using namespace std;
//priority_queue<int,vector<int>,greater<int>> que;
const double EPS = 1.0e-8;
typedef pair<int, int> pairint;
typedef long long ll;
typedef unsigned long long ull;
const int maxn = 2e5 + ;
const int maxm = ;
//next_permutation
//priority_queue<int, vector<int>, greater<int>> que;
ll dp[];
ll num[];
int main()
{
//freopen("bonuses.in", "r", stdin);
//freopen("out.txt", "w", stdout);
int n;
while (cin >> n && n)
{
mem(dp, );
ll ans = ;
for (int i = ; i <= n; i++)
{
cin >> num[i];
}
ans = dp[] = num[];
for (int i = ; i <= n; i++)
{
dp[i]=num[i];
for (int j = ; j < i; j++)
{
if (num[j] < num[i])
{
dp[i] = max(dp[i], dp[j] + num[i]);
}
}
ans = max(ans, dp[i]);
}
cout << ans << endl;
}
}
hdu 1087 最大递增子序列和的更多相关文章
- HDU 1087 最大递增子序列
Super Jumping! Jumping! Jumping! Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 ...
- HDU 1087 最大上升子序列的和
Super Jumping! Jumping! Jumping! Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 ...
- hdu 1087 最大上升子序列的和(dp或线段树)
Super Jumping! Jumping! Jumping! Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 ...
- hdu 1087 最大递增和
思路和LIS差不多,dp[i]为i结尾最大值 #include <iostream> #include <string> #include <cstring> #i ...
- HDU 1087 简单dp,求递增子序列使和最大
Super Jumping! Jumping! Jumping! Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 ...
- HDU 1087 Super Jumping! Jumping! Jumping! 最大递增子序列
Super Jumping! Jumping! Jumping! Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 ...
- HDU 1087 Super Jumping! Jumping! Jumping! 最长递增子序列(求可能的递增序列的和的最大值) *
Super Jumping! Jumping! Jumping! Time Limit:1000MS Memory Limit:32768KB 64bit IO Format:%I64 ...
- HDU 1257 最少拦截系统 最长递增子序列
HDU 1257 最少拦截系统 最长递增子序列 题意 这个题的意思是说给你\(n\)个数,让你找到他最长的并且递增的子序列\((LIS)\).这里和最长公共子序列一样\((LCS)\)一样,子序列只要 ...
- (最大上升子序列) Super Jumping! Jumping! Jumping! -- hdu -- 1087
http://acm.hdu.edu.cn/showproblem.php?pid=1087 Super Jumping! Jumping! Jumping! Time Limit:1000MS ...
随机推荐
- jsp四种属性范围
在JSP提供了四种属性的保存范围.所谓的属性保存范围,指的就是一个设置的对象,可以在多个页面中保存并可以继续使用.它们分别是:page.request.session.appliction. 1.pa ...
- 编译rxtx
https://blog.csdn.net/github_29989383/article/details/51886234 https://cloud.tencent.com/developer/a ...
- 七:flask-一些小细节
1.在局域网中,让其他电脑访问我的网站:host参数 如果设置为0.0.0.0,则在局域网中,输入当前项目所在的ip+端口就可以访问这个项目如果host设置为固定的ip,如host=‘'192.168 ...
- Delphi 快速检测是否联网 判断网线是否拔开。 但是不能判断是否能上网
https://blog.csdn.net/chelen_jak/article/details/50204145 Delphi 快速检测是否联网 2015年12月07日 12:01:26 chele ...
- DedeCMS系统设置说明:站点设置
DedeCMS系统设置说明:站点设置 http://www.ithov.com/master/114583.shtml DedeCMS系统设置说明:站点设置 2012-03-28 15:31来源:风信 ...
- zabbix+grafana使用
参照文档 https://blog.csdn.net/xiegh2014/article/details/54928883
- Windows 2008任务计划执行bat脚本失败返回0x1
测试环境: C:\>systeminfo | findstr /c:"OS Name"OS Name: Microsoft Windows ...
- mysql数据库delete数据时不支持表别名!!!
mysql数据库delete数据时不支持表别名!!! mysql delete时候 提示语法错误!如下sql: 去掉 表别名的时候: 正确的写法例如: DELETE FROM COMMENTS_REP ...
- c++ 调用 sqlite
#include <iostream> #include "sqlite3.h" using namespace std; void dbTest() { #pragm ...
- 应用安全 - harbaor - 漏洞汇总
CVE-2019-19026(SQL注入,高危):https://github.com/goharbor/harbor/security/advisories/GHSA-rh89-vvrg-fg64( ...