hdu1087Super Jumping! Jumping! Jumping!
Posted yijiull
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了hdu1087Super Jumping! Jumping! Jumping!相关的知识,希望对你有一定的参考价值。
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1087
1 #include<cstdio> 2 #include<cstring> 3 #include<algorithm> 4 using namespace std; 5 const int maxn=1010; 6 int dp[maxn],p[maxn]; 7 int n; 8 9 int main() 10 { 11 p[0]=-0x3f3f3f3f; 12 while(scanf("%d",&n)&&n) 13 { 14 int ans=-0x3f3f3f3f; 15 memset(dp,0,sizeof(dp)); 16 for(int i=1;i<=n;i++) 17 { 18 scanf("%d",&p[i]); 19 dp[i]=p[i]; 20 for(int j=0;j<i;j++) 21 if(p[j]<p[i]) 22 { 23 dp[i]=max(dp[i],dp[j]+p[i]); 24 ans=max(ans,dp[i]); 25 } 26 } 27 printf("%d\n",ans); 28 29 } 30 }
以上是关于hdu1087Super Jumping! Jumping! Jumping!的主要内容,如果未能解决你的问题,请参考以下文章
Super Jumping! Jumping! Jumping! HDU - 1087
HDU-1087 Super Jumping! Jumping! Jumping!
HDU 1087Super Jumping! Jumping! Jumping!
HDU 1087 Super Jumping! Jumping! Jumping!