/*

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.

状态分析 node(pos,num,sum)
(k+1).sum = max((i--k).sum) +(k+1).num
*/
#include<iostream>
#include<vector>
#include<cstdlib>
#include<cstdio>
using namespace std;
int N;
int main()
{
int i,j;
int a[];
int sum[];
cin>>N;
while(N!=)
{
int all_max = -;
memset(a,-,sizeof(a));
memset(sum,,sizeof(sum));
for(i=;i<N;i++)
{
cin>>a[i];
if(i==)
{
sum[] = a[i];
continue;
}
int max = -;
bool sign = true;
for(j=;j<i;j++)//找出i之前位置中小于a[i]的位置中最大的sum,如果没有就sign = true
{
if(a[j]<a[i])
{
sign = false;
if(sum[j]>max)
max = sum[j];
}
}
if(sign)//此时sum值为a[i]
sum[i] = a[i];
else //否则状态转移方程可知
sum[i] = a[i] + max;
if(sum[i]>all_max)
all_max = sum[i];
}
cout<<all_max<<endl;
cin>>N;
}
}

E - Super Jumping! Jumping! Jumping!的更多相关文章

  1. HDU - 1087 Super Jumping!Jumping!Jumping!(dp求最长上升子序列的和)

    传送门:HDU_1087 题意:现在要玩一个跳棋类游戏,有棋盘和棋子.从棋子st开始,跳到棋子en结束.跳动棋子的规则是下一个落脚的棋子的号码必须要大于当前棋子的号码.st的号是所有棋子中最小的,en ...

  2. Super Jumping! Jumping! Jumping!

    Nowadays, a kind of chess game called “Super Jumping! Jumping! Jumping!” is very popular in HDU. May ...

  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! 简单的dp

    Super Jumping! Jumping! Jumping! Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 ...

  5. Super Jumping! Jumping! Jumping!——E

    E. Super Jumping! Jumping! Jumping! Time Limit: 1000ms Memory Limit: 32768KB 64-bit integer IO forma ...

  6. HDU 1087 Super Jumping! Jumping! Jumping! 最大递增子序列

    Super Jumping! Jumping! Jumping! Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 ...

  7. HDU 1087 Super Jumping! Jumping! Jumping

    HDU 1087 题目大意:给定一个序列,只能走比当前位置大的位置,不可回头,求能得到的和的最大值.(其实就是求最大上升(可不连续)子序列和) 解题思路:可以定义状态dp[i]表示以a[i]为结尾的上 ...

  8. HDU 1087 Super Jumping! Jumping! Jumping! (DP)

    C - Super Jumping! Jumping! Jumping! Time Limit:1000MS     Memory Limit:32768KB     64bit IO Format: ...

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

    Super Jumping! Jumping! Jumping! Problem Description Nowadays, a kind of chess game called “Super Ju ...

随机推荐

  1. jquery中 $(document).ready()和window.onload的区别

    1.执行时间 window.onload必须等到页面内包括图片的所有元素加载完毕后才能执行. $(document).ready()是DOM结构绘制完毕后就执行,不必等到加载完毕. 2.编写个数不同 ...

  2. User Get 'Access Denied' with Excel Service WebPart

    用户可以访问网站,并且具有相应的访问权限. 用户尝试了其他浏览器和IE的其他版本. 解决: 将用户添加到 ‘Excel Services Views’ 这个SharePoint组就OK了.

  3. 本周进步要点20161023(含李笑来第二场live笔记要点)

    本周主要忙于去武汉参加iDOF2016智能数字油田会议,会上做了题为“油田SOA及云平台的系统思考与实践”的报告,为了准备这篇报告,用到了一些以前学过的知识,具体内容见“参加iDOF2016会议的收获 ...

  4. android:使用RemoteView自定义Notification

    //网上相关内容较少,遂记录下来,备忘. //依然以音乐播放器demo为例. 效果截图 //锤子手机上的效果 step1 准备自定义layout 常规的实现方式,并不会因为是用于notificatio ...

  5. Windows 双网卡指定网络出口

    主要命令: ipconfig route ping tracert     指定外网路由通过本地以太网连接出去 route add -p 0.0.0.0 mask 0.0.0.0 192.168.10 ...

  6. border 外边框

    语法: border:<line-width> || <line-style> || <color> <line-width> = <length ...

  7. ORA-01336: specified dictionary file cannot be opened

    这篇介绍使用Logminer时遇到ORA-01336: specified dictionary file cannot be opened错误的各种场景 1:dictionary_location参 ...

  8. 不同版本SQL SERVER备份还原时造成索引被禁用

    以下测试例子以SQL 2008备份,在SQL2014还原,造成索引被禁用. --备份环境(SQL Server 2008 R2) /* MicrosoftSQL Server 2008 R2 (RTM ...

  9. [已解决]Teamviewer VPN 连接上,但无法ping

    用Teamveiwer 可以进行远程控制连接.用了VPN功能后,起先也正常.可以PING和其他网络操作. 后来忽然始终VPN连接上后,无法PING和做其他的网络操作了. 检查缘由是对方TeamView ...

  10. dom4j读取某个元素的某个属性

    一.dom4j介绍 dom4j是一个Java的XML API,类似于jdom,用来读写XML文件的.dom4j是一个非常非常优秀的Java XML API,具有性能优异.功能强大和极端易用使用的特点, ...