Super Jumping! Jumping! Jumping!

Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)

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 2
4 1 2 3 4
4 3 3 2 1
0

Sample Output

4
10
3

Author

lcy

题意:跳数字游戏,下一个数字必须比当前数字大,每一次都可以 获取当前数字的值
题解:dp求上升序列的和

Select Code#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <algorithm>using namespace std;const int maxn = 1050;int main()
{int dp[maxn],s[maxn],n,i,j,Max,mm;while(scanf("%d",&n)!=EOF&&n){for(i=0;i<n;i++)scanf("%d",&s[i]);dp[0] = s[0];Max = s[0];for(i=1;i<n;i++){mm = 0;for(j=0;j<i;j++){if(s[i]>s[j]&&mm<dp[j])mm = dp[j];}dp[i] = mm + s[i];Max = max(Max,dp[i]);}printf("%d\n",Max);}return 0;
}

转载于:https://www.cnblogs.com/luoxiaoyi/p/9821674.html

HDU_1087-Super Jumping! Jumping! Jumping!相关推荐

  1. HDU OJ Super Jumping! Jumping! Jumping!

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

  2. hdu 1087 Super Jumping! Jumping! Jumping!

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

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

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

  4. Super Jumping! Jumping! Jumping!

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

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

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

  6. Super Jumping! Jumping! Jumping! HDU - 1087

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

  7. 动态规划训练17 [Super Jumping! Jumping! Jumping! HDU - 1087 ]

    Super Jumping! Jumping! Jumping! HDU - 1087 过于简单懒得说了 #include <cstdio> #include <algorithm& ...

  8. hdu 1087 Super Jumping! Jumping! Jumping!

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

  9. 【HDU - 1087】Super Jumping! Jumping! Jumping! (最大上升子序列类问题,dp)

    题干: Nowadays, a kind of chess game called "Super Jumping! Jumping! Jumping!" is very popul ...

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

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

最新文章

  1. 简单分析几个常见的排序算法(C语言)
  2. java为什么复制数组会减一_如果从数组中复制了Java,为什么Java需要对最终变量进行显式强制转换?...
  3. DiscuzToolkit
  4. 服务器虚拟化怎么使用,服务器使用中的误区及建议 服务器虚拟化安装步骤
  5. EditPlus常用快捷键
  6. 吴恩达《机器学习》学习笔记四——单变量线性回归(梯度下降法)代码
  7. 消息中间件Kafka与RabbitMQ谁更胜一筹?
  8. 对.Net 垃圾回收的C#编程相关方面(Finalize 和Dispose(bool disposing)和 Dispose())的一些理解体会...
  9. unix文件中i节点
  10. 运动控制系统课程设计
  11. 英文垃圾邮件分类机器学习篇——带你一次看个爽
  12. UWB定位系统部署原则
  13. c语言青蛙跳答案是多少啊,青蛙跳台阶问题(示例代码)
  14. 北京交通大学c语言作业,北京交通大学c语言综合程序设计(黄宇班).doc
  15. 汇编语言L0C,单片机汇编语言指令查表.doc
  16. 沪深A股指数历史分时交易数据API接口(JSON标准格式,Get请求方式)
  17. java中switch的用法和逻辑运算符
  18. C语言习题练习2——被5整除问题
  19. QT使用QStackedWidget实现切页显示
  20. 小白入门miniconda安装教程

热门文章

  1. linux内核模块的强制删除-结束rmmod这类disk sleep进程
  2. PowerDesigner最基础的使用方法入门学习
  3. Head First Design Pattern
  4. 编程之美2015资格赛 题目2 : 回文字符序列 [ 区间dp ]
  5. Android的目录结构说明
  6. 使用NVelocity自动生成Favorite收藏夹的导航页面
  7. 行业观察(一)| 从渠道为王到数据为王——浅谈服装零售企业的数字化转型...
  8. Docker+Jenkins持续集成环境(3)集成PMD、FindBugs、Checkstyle静态代码检查工具并邮件发送检查结果...
  9. dubbo开发环境和生产环境搭建
  10. jquery.autocomplete自动补全功能