hdu1087---Super Jumping! Jumping! Jumping!

Problem Description
Nowadays, a kind of chess game called “Super Jumping! Jumping! Jumping!” is very popular in HDU. Maybe you are a good boy, and know little about this game, so I introduce it to you now.

The game can be played by two or more than two players. It consists of a chessboard（棋盘）and some chessmen（棋子）, and all chessmen are marked by a positive integer or “start” or “end”. The player starts from start-point and must jumps into end-point finally. In the course of jumping, the player will visit the chessmen in the path, but everyone must jumps from one chessman to another absolutely bigger (you can assume start-point is a minimum and end-point is a maximum.). And all players cannot go backwards. One jumping can go from a chessman to next, also can go across many chessmen, and even you can straightly get to end-point from start-point. Of course you get zero point in this situation. A player is a winner if and only if he can get a bigger score according to his jumping solution. Note that your score comes from the sum of value on the chessmen in you jumping path.
Your task is to output the maximum value according to the given chessmen list.

Input
Input contains multiple test cases. Each test case is described in a line as follow:
N value_1 value_2 …value_N
It is guarantied that N is not more than 1000 and all value_i are in the range of 32-int.
A test case starting with 0 terminates the input and this test case is not to be processed.

Output
For each case, print the maximum according to rules, and one line one case.

Sample Input
`3 1 3 24 1 2 3 44 3 3 2 10`

Sample Output
`4103`

```#include

using namespace std;int dp[1001],a[1001];int main(){
int n;
while(cin>>n)
{
if(n==0)break;
for(int i=0;i

{
cin>>a[i];
dp[i]=a[i];
}
for(int i=0;i

{
for(int j=0;j

{
if(a[i]>a[j]&&dp[j]+a[i]>dp[i])
{
dp[i]=a[i]+dp[j];
}
}
}
int max=-1;
for(int i=0;i

{
if(dp[i]>max)
{
max=dp[i];
}
}
cout<

<

}
return 0;}

```

#### 最新留言

[***.249.68.14]2022年05月22日 17时41分27秒

## 关于作者

喝酒易醉，品茶养心，人生如梦，品茶悟道，何以解忧？唯有杜康！
-- 愿君每日到此一游！

## 最新文章

php5中 类有哪些成员,PHP5中的类与对象 2019-06-17 01:25:32
python渗透工具,基于 Python 的反连 Shell 和后渗透工具 2019-06-17 01:25:31
php修改缓存文件保存地址,php文件缓存(改进型) 2019-06-17 01:25:31
php 自定义伪静态,SpeedPHP/自定义伪静态URL 2019-06-17 01:25:30
php 向is里面传值,php中is 2019-06-17 01:25:30
php和nodejs连接mysql数据库,nodejs简单访问及操作mysql数据库的方法示例 2019-06-17 01:25:29
php 获取一年有多少天,【后端开发】php获取一年有多少天 2019-06-17 01:25:29
php异步刷新对页面删除,php+jQuery+Ajax简单实现页面异步刷新 2019-06-17 01:25:28
wamp的php替换,wamp更换php版本教程 2019-06-17 01:25:28
mysql 5.7.17 高可用,MySQL 5.7 高可用性分析 2019-06-17 01:25:27
php urldecode 加号,php|urldecode urlencode 的加号问题 2019-06-17 01:25:27
java异常汇总,java exception java异常汇总(3) 2019-06-17 01:25:26
java 2个string 类型转换date 并比较大小,java String 和date 转换 以及时间的比较 2019-06-17 01:25:26
php与json,PHP与json 2019-06-17 01:25:25
php xhtml格式,XHTML怎么打开?XHTML的规范的内容是什么？ 2019-06-17 01:25:25
spring django php,Biny——腾讯开源的超轻量级 PHP 框架 2019-06-17 01:25:24
php环境安装包redhot,搭建php环境 2019-06-17 01:25:23
php继承 重写方法吗,PHP类和对象类的继承及重写(方法重写) 2019-06-17 01:25:22
php 图片处理慢,php常用图片处理类 2019-06-17 01:25:22