Super Jumping! Jumping! Jumping!
Posted cadcadcad
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Super Jumping! Jumping! Jumping!相关的知识,希望对你有一定的参考价值。
E - Super Jumping! Jumping! Jumping!
思路:就是按照求最长有序子序列的思路来写,跟Monkey and Banana的思路大同小异。
代码:
// Created by CAD on 2019/10/26.
#include <bits/stdc++.h>
using namespace std;
int dp[1005];
int a[1005];
int main()
{
ios::sync_with_stdio(false);
cin.tie(0);
int n;
while(cin>>n&&n)
{
int maxn=0;
for(int i=1;i<=n;++i)
cin>>a[i],dp[i]=a[i],maxn=max(maxn,a[i]);
for(int i=1;i<=n;++i)
for(int j=1;j<i;++j)
if(a[i]>a[j])
dp[i]=max(dp[i],dp[j]+a[i]),maxn=max(maxn,dp[i]);
cout<<maxn<<endl;
}
return 0;
}
以上是关于Super Jumping! Jumping! Jumping!的主要内容,如果未能解决你的问题,请参考以下文章
[2016-03-27][HDU][1087][Super Jumping! Jumping! Jumping!]
Super Jupmping ! Jumping ! Jumping
HDU-1087.Super Jumping! Jumping! Jumping!
hdu 1087 Super Jumping! Jumping! Jumping! (dp最大递增字段和)