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.

InputInput 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.
OutputFor each case, print the maximum according to rules, and one line one case.
Sample Input

3 1 3 2
4 1 2 3 4
4 3 3 2 1
0

Sample Output

4
10
3
 1 #include<iostream>
 2 #include<stdio.h>
 3 #include<string.h>
 4 #include<algorithm>
 5 using namespace std;
 6 int dp[1005];
 7 int main()
 8 {
 9     int n;
10     while(cin>>n)
11     {
12         if(n==0)   break;
13         int num[1005];
14         num[0]=0;
15         for(int i=1;i<=n;i++)
16             cin>>num[i];
17         memset(dp,0,sizeof(dp));
18         for(int i=1;i<=n;i++)
19         {
20             for(int j=i-1;j>=0;j--)
21             {
22                 if(num[i]>num[j])
23                     dp[i]=max(dp[i],dp[j]+num[i]);
24             }
25         }
26         int mx=0;
27         for(int i=1;i<=n;i++)
28             mx=max(mx,dp[i]);
29         cout<<mx<<endl;
30     }
31     return 0;
32 }

转载于:https://www.cnblogs.com/ISGuXing/p/7257692.html

HDU-1087 Super Jumping! Jumping! Jumping!相关推荐

  1. hdu 1087 Super Jumping! Jumping! Jumping!

    Nowadays, a kind of chess game called "Super Jumping! Jumping! Jumping!" is very popular i ...

  2. hdu 1087 Super Jumping! Jumping! Jumping! 动态规划

    Super Jumping! Jumping! Jumping! Time Limit : 2000/1000ms (Java/Other)   Memory Limit : 65536/32768K ...

  3. DP专题训练之HDU 1087 Super Jumping!

    Description Nowadays, a kind of chess game called "Super Jumping! Jumping! Jumping!" is ve ...

  4. hdu 1087 Super Jumping! Jumping! Jumping!

    Nowadays, a kind of chess game called "Super Jumping! Jumping! Jumping!" is very popular i ...

  5. HDU 1087 Super Jumping! Jumping! Jumping!【最大递增子段和】

    Problem Description Nowadays, a kind of chess game called "Super Jumping! Jumping! Jumping!&quo ...

  6. 最长上升子序列模板 hdu 1087 Super Jumping! Jumping! Jumping!

    Nowadays, a kind of chess game called "Super Jumping! Jumping! Jumping!" is very popular i ...

  7. hdu - 1087 - Super Jumping! Jumping! Jumping!

    题意:求最大升序和. 题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1087 -->>设d[i]表示以第i个数为终点的最大升序和,然后从第1 ...

  8. HDU 1087 [Super Jumping! Jumping! Jumping!]动态规划

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1087 题目大意:有N个格子,每个格子有数值.从原点开始跳,可以跳到任何一个位置:在某一个位置,只能跳到 ...

  9. HDU 1087 Super Jumping! Jumping! Jumping! (最长上升子序列的变形,子序列值最大)

    题意 wsw获得了与小姐姐约会的机会,同时也不用担心wls会发现了,可是如何选择和哪些小姐姐约会呢?wsw希望自己可以循序渐进,同时希望挑战自己的极限,我们假定每个小姐姐有一个"攻略难度值& ...

  10. Super Jumping! Jumping! Jumping! HDU - 1087

    Super Jumping! Jumping! Jumping! HDU - 1087 题意: 给定一条长度为n的序列,其中一定存在一条元素和最大的严格上升子序列,求这条序列的元素和. 题解: 最长上 ...

最新文章

  1. Windows server 2012 搭建×××图文教程(一)安装×××相关服务
  2. [原创] 为Visio添加公式编辑器工具栏按钮
  3. android盒子模拟器,emubox模拟器盒子
  4. 【数学建模】MATLAB应用实战系列(八十二)-【数学建模】非线性多元回归(附MATLAB代码)
  5. 荣耀20青春版鸿蒙,荣耀20青春版曝光,浴霸三摄+麒麟810+系统亮点满满
  6. android热修复原理底层替换,Android 热修复 - 各框架原理学习及对比
  7. Java中多线程的使用!!
  8. python控制流水灯_B站智能防挡弹幕的一种python实现
  9. RocketMQ是怎么存储消息的?
  10. js中JSON的使用
  11. 容器技术Docker K8s 6 阿里云容器服务体系介绍
  12. web与app开发java_移动web开发和移动app开发的区分
  13. 5G如何成为相关行业的创新引擎,提升服务和盈利水平
  14. i7-10750H和i7-8750H 对比哪个好
  15. Java第十二周作业
  16. rm -rf 命令 与正则表达式
  17. 面试题:数据库优化的方法
  18. 文献阅读笔记-CSC-数据集-A Hybrid Approach to Automatic Corpus Generation for Chinese Spelling Check
  19. 毕业设计—共享图书小程序3.0 全新UI
  20. Android 编译之source和lunch

热门文章

  1. 照相馆里的魔术师-数码照片处理大全二
  2. 递归(二)-------经典递归实例(汉诺塔问题)
  3. “世界百位名人”诠释上海世博会城市主题
  4. 使用剪切板[3]: SetComponent、GetComponent
  5. 详解苹果 macOS Mail 中的零点击漏洞
  6. HDU 2152 Fruit (母函数)
  7. [仁润云技术团队]并发编程-(1)基本概念
  8. 洛谷 1541 乌龟棋——dp
  9. Intel的AVX2指令集解读
  10. sql server2008如果表中已经有很多条记录,再添加一个非空字段