Super Jumping! Jumping! Jumping!——E
E. Super Jumping! Jumping! Jumping!
Time Limit: 1000ms
64-bit integer IO format: Java class name:
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
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
Sample Input
3 1 3 2
4 1 2 3 4
4 3 3 2 1
0
Sample Output
4
10
3 题意:求最大递增子段和,
#include <cstdio>
#include <iostream>
#include<cstring>
using namespace std;
const int inf = ;
int main()
{
int n,a[],sum[],maxn;
while(scanf("%d",&n)&&n)
{
memset(sum,,sizeof(sum));
for(int i = ;i<=n;i++)
scanf("%d",&a[i]);
for(int i=;i<=n;i++)
{
maxn=-inf;
for(int j=;j<i;j++)
if(a[i]>a[j])
maxn=max(maxn,sum[j]);
sum[i]=maxn+a[i];
}
maxn=-inf;
for(int i=;i<=n;i++)
{
if(sum[i]>maxn) maxn=sum[i];
}
printf("%d\n",maxn);
}
return ;
}
Super Jumping! Jumping! Jumping!——E的更多相关文章
- HDU - 1087 Super Jumping!Jumping!Jumping!(dp求最长上升子序列的和)
传送门:HDU_1087 题意:现在要玩一个跳棋类游戏,有棋盘和棋子.从棋子st开始,跳到棋子en结束.跳动棋子的规则是下一个落脚的棋子的号码必须要大于当前棋子的号码.st的号是所有棋子中最小的,en ...
- E - Super Jumping! Jumping! Jumping!
/* Nowadays, a kind of chess game called "Super Jumping! Jumping! Jumping!" is very popula ...
- Super Jumping! Jumping! Jumping!
Nowadays, a kind of chess game called “Super Jumping! Jumping! Jumping!” is very popular in HDU. May ...
- DP专题训练之HDU 1087 Super Jumping!
Description Nowadays, a kind of chess game called "Super Jumping! Jumping! Jumping!" is ve ...
- hdu 1087 Super Jumping! Jumping! Jumping! 简单的dp
Super Jumping! Jumping! Jumping! Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 ...
- HDU 1087 Super Jumping! Jumping! Jumping! 最大递增子序列
Super Jumping! Jumping! Jumping! Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 ...
- HDU 1087 Super Jumping! Jumping! Jumping
HDU 1087 题目大意:给定一个序列,只能走比当前位置大的位置,不可回头,求能得到的和的最大值.(其实就是求最大上升(可不连续)子序列和) 解题思路:可以定义状态dp[i]表示以a[i]为结尾的上 ...
- HDU 1087 Super Jumping! Jumping! Jumping! (DP)
C - Super Jumping! Jumping! Jumping! Time Limit:1000MS Memory Limit:32768KB 64bit IO Format: ...
- HDU 1087 Super Jumping! Jumping! Jumping!(动态规划)
Super Jumping! Jumping! Jumping! Problem Description Nowadays, a kind of chess game called “Super Ju ...
随机推荐
- xcode6 下 ios simulator 有 Home 键么?
4s之前 ,现在,只能用command+shift+h来代替
- mathematica练习程序(获得股票数据)
从去年的11月开始,中国的股市就一直大涨,不知道这次能持续多长时间. 为了获得股票数据,我用matlab试了网上的一些方法,总是失败,所以就改用mathematica,一行代码就可以了. DateLi ...
- Android中log使用方法
private static final String ACTIVITY_TAG="MainActivity"; Log.v(MainActivity.ACTIVITY_TAG, ...
- Java生成验证码小工具
无意中看到一个生成简易验证码的小工具类(保存学习): 工具类代码: import java.awt.BasicStroke; import java.awt.Color; import java.aw ...
- kylin查询出现日期对应不上的情况
情况: 查询的是2016年1月2日的数据,但返回解析出来的数据确实是2号的,可是时间竟然变成了2016年1月1日. 解决: 是时区问题,修改本地时区 具体代码,主要是看加红加粗的: public st ...
- Android拓展系列(11)--打造Windows下便携的Android源码阅读环境
因为EXT和NTFS格式的差异,我一直对于windows下阅读Android源码感到不满. 前几天,想把最新的android5.0的源码下下来研究一下,而平时日常使用的又是windows环境,于是专门 ...
- hdu2255 二分图最大权配KM
KM算法:hdu2255 (大概理解了 参考博客: http://blog.csdn.net/niushuai666/article/details/7171880) 所谓交错树:就是 ...
- appium运行报错.<init>(Lorg/openqa/selenium/remote/ErrorCodes;Z)V
最近这几天就在学习appium,搭建环境就耗费了很多时间,不得不承认自己够笨的了,然后我把环境搭建好,写完脚本的时候,就报这个错了,当时是从某个群里直接下载的demo,不得不吐槽说,够坑的,是能跑通, ...
- python闭包与装饰器
转自小马哥: 闭包和装饰器充分体现了Python语法糖的优雅感觉. 在本文中,我们的实验要完成两个工作,一个是加法,一个是累计调用加法的次数,最普通的Python程序可以这么写: def valida ...
- Redis 事务总结
特点: 对单个客户端可以执行连续性事务(在一个线程内): 执行命令要排队: mutil类似begin trans; exec 类似 commit; discard 用于放弃事务: watch ...