HDU 1087 Super Jumping! Jumping! Jumping!(动态规划)
Super Jumping! Jumping! Jumping!

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.
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.
# include <iostream>
# include<cstdio>
# define LL long long
using namespace std; int main()
{
int n,ans,max,i,j;
int s[],a[]; //s[i]表示最末尾是a[i]这个数的结果
bool flag;
while(scanf("%d",&n)&& n)
{
for(i=; i<n; i++)
{
scanf("%d",&a[i]);
s[i] = ;
}
s[] = a[];
for(i=; i<n; i++)
{
s[i] = a[i];
for(j=; j<i; j++)
{
if(a[i]>a[j] && s[j]+a[i]>s[i])
{
s[i] = s[j] + a[i];
}
}
}
max = ;
for(i=;i<n;i++)
{
if(s[i]>max)
max = s[i];
}
printf("%d\n",max);
}
return ;
}
HDU 1087 Super Jumping! Jumping! Jumping!(动态规划)的更多相关文章
- HDU 1087 Super Jumping! Jumping! Jumping
HDU 1087 题目大意:给定一个序列,只能走比当前位置大的位置,不可回头,求能得到的和的最大值.(其实就是求最大上升(可不连续)子序列和) 解题思路:可以定义状态dp[i]表示以a[i]为结尾的上 ...
- hdu 1087 Super Jumping! Jumping! Jumping!(动态规划DP)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1087 Super Jumping! Jumping! Jumping! Time Limit: 200 ...
- HDU 1087 Super Jumping! Jumping! Jumping!(求LSI序列元素的和,改一下LIS转移方程)
题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=1087 Super Jumping! Jumping! Jumping! Time Limit: 20 ...
- HDU 1087 Super Jumping! Jumping! Jumping! 最长递增子序列(求可能的递增序列的和的最大值) *
Super Jumping! Jumping! Jumping! Time Limit:1000MS Memory Limit:32768KB 64bit IO Format:%I64 ...
- 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....(动态规划之最大递增子序列和)
Super Jumping! Jumping! Jumping! Problem Description Nowadays, a kind of chess game called “Super Ju ...
- hdu 1087 Super Jumping! Jumping! Jumping!(动态规划)
题意: 求解最大递增子序列. 例如:3 1 3 2 输入 3 个数 1 3 2 则递增子序列有 {1} {3} {2} {1 3} {1 2} ,故输出子序列的最大和 4 解题思路: x[n](n个 ...
- HDU 1087 Super Jumping! Jumping! Jumping! 最大递增子序列
Super Jumping! Jumping! Jumping! Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 ...
随机推荐
- NGUI学习笔记(一):官方视频学习记录
学习NGUI一直断断续续的,目前打算做一个总结的笔记. 我使用的是比较老的3.6.0版本. 1.使用NGUI,需要开启“Edit”->“Project Settings”->“Physic ...
- 测试JS基本类型以及对象的引用
自己敲的. 1 <script src="https://ajax.googleapis.com/ajax/libs/prototype/1.7.1.0/prototype.js&qu ...
- C# & SQLite - Storing Images
Download source code - 755 KB Introduction This article is to demonstrate how to load images into ...
- innobackupex 单脚本循环7天一全备6增备脚本更新
#!/bin/bash #日期转为天数 function date2days { echo "$*" | awk '{ z=-$)/); y=$+-z; m=$+*z-; j=*m ...
- 本地或者是koala软件编译less文件为css
背景: 事情的起因是这般的,平时工作是在线上办公,样式是使用less来写,于是乎,这样我从线上download下来的less文件无法直接在自己的本地环境运行.有一个问题就是我要把less文件先编译成c ...
- CocoaPods使用命令
5.需要在工程中创建一个Podfile文件, 使用命令: $cd /Users/shiyunlei/Desktop/CocoapodsSample(进入工程目录,cd后面的是工程的路径) $ touc ...
- Custom Properties for Alert Description and Notification(PropertyBag)
Alert Description Variables: For event Rules: EventDisplayNumber (Event ID): $Data/Event ...
- 字符编码的故事(ASCII,ANSI,Unicode,Utf-8区别)转载
http://www.imkevinyang.com/2009/02/字符编解码的故事(ascii,ansi,unicode,utf-8区别).html 很久很久以前,有一群人,他们决定用8个可以开合 ...
- skip-character-set-client-handshake 与 character-set-client-handshake
my.cnf [mysql] default-character-set = gbk [mysqld] skip-character-set-client-handshake=1 跳过mysql程序起 ...
- javascript关闭浏览器窗口
var opened=window.open('about:blank','_self'); opened.close(); window.open 不被阻止 .open('_blank') 然后 t ...