Super Jumping! Jumping! Jumping!(HDOJ1087)

原题链接:http://acm.hdu.edu.cn/showproblem.php?pid=1087

#include<stdio.h> #include<memory.h>
int main() { int count; int arr[1001],sum[1001]; scanf("%d",&count); int max; while(count!=0) { memset(sum,0,sizeof(sum)); for(int i=0;i<count;i++) { scanf("%d",&arr[i]); sum[0]=arr[0]; for(int j=0;j<i;j++) { max=0; if(arr[j]<arr[i]) max=sum[j]+arr[i]; else max=arr[i]; if(max>sum[i]) sum[i]=max; } } int temp=sum[0]; for(int i=0;i<count;i++) { if(temp<sum[i]) temp=sum[i]; } printf("%d\n",temp); scanf("%d",&count); } }
posted @ 2013-04-03 23:04  supersnow0622  Views(112)  Comments(0)    收藏  举报