标签:
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 34052 Accepted Submission(s): 15437
#include<iostream> #include<stdio.h> #include<algorithm> using namespace std; const int maxn = 1005; int num[maxn]; long long dp[maxn]; int main() { int n; while(~scanf("%d",&n)&&n) { for(int i=0;i<n;i++) { scanf("%d",num+i); dp[i]=(long long )num[i]; } long long maxx=-0x3fffffff; for(int i=0;i<n;i++) { for(int j=0;j<i;j++) { if(num[j]<num[i]) dp[i]=max(dp[i],dp[j]+num[i]); } maxx=max(maxx,dp[i]); } printf("%I64d\n",maxx); } return 0; }
hdu 1087 Super Jumping! Jumping! Jumping! 简单的dp
标签:
原文地址:http://www.cnblogs.com/superxuezhazha/p/5793660.html