HDUOJ----Super Jumping! Jumping! Jumping!
Super Jumping! Jumping! Jumping!
Time Limit : 2000/1000ms (Java/Other) Memory Limit : 65536/32768K (Java/Other)
Total Submission(s) : 5 Accepted Submission(s) : 1

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.
4 1 2 3 4
4 3 3 2 1
0
10
3
for(i=;i<n;i++)
{
temp=;
for(j=;j<i;j++)
{
if(arr[i]>arr[j]&&dp[j]>temp)
temp=dp[j];
}
dp[i]=temp+arr[i];
}
上面的公式,运用的范围极为广泛....注意记下来!!
代码如下:
#include<iostream>
#include<vector>
using namespace std;
int main()
{
int n,i,j,temp;
while(cin>>n,n)
{
vector<int>arr(n,);
vector<int>dp(n,);
for(i=;i<n;i++)
{
cin>>arr[i];
}
int max=;
for(i=;i<n;i++)
{
temp=;
for(j=;j<i;j++)
{
if(arr[i]>arr[j]&&dp[j]>temp)
temp=dp[j];
}
dp[i]=temp+arr[i]; max=max>dp[i]?max:dp[i];
}
cout<<max<<endl;
}
return ;
}
HDUOJ----Super Jumping! Jumping! Jumping!的更多相关文章
- 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 ...
- Super Jumping! Jumping! Jumping!——E
E. Super Jumping! Jumping! Jumping! Time Limit: 1000ms Memory Limit: 32768KB 64-bit integer IO forma ...
- 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 ...
随机推荐
- Top N的MapReduce程序MapReduce for Top N items
In this post we'll see how to count the top-n items of a dataset; we'll again use the flatland book ...
- cmake函数參数解析
近期在迁移公司的make系统到cmake上.发现cmake的function參数非常奇怪.比如,假设我们向一个function传递list作为參数,在function中,形參会变成例如以下状况: se ...
- 如何重构"箭头型"代码
本文主要起因是,一次在微博上和朋友关于嵌套好几层的if-else语句的代码重构的讨论(微博原文),在微博上大家有各式各样的问题和想法.按道理来说这些都是编程的基本功,似乎不太值得写一篇文章,不过我觉得 ...
- 如何在Window 7 64位 PL/SQL 访问oracle 数据库
一般 PLSQL Developer 没有64位版本,所以在64位系统上运行该程链接64位Oracle时就会报错.解决的方法如下: 第零步:在windows 7 中安装Oracle 11g 64 数据 ...
- (转)Unity中protobuf的使用方法
在移动手机游戏开发中,目前Unity3D已成为比较主流的开发技术. 那么对于客户端服务器协议的打解包,我们有3中常用的处理方式: 1.自定义结构体:在协议中直接传输代码中自定义的结构体:这种方式的坏处 ...
- linux环境中设置jacoco覆盖率
cd /alidata1/admin/za-themis pkill -9 -f za-themis #CATALINA_HOME=/root/za-tomcat #CATALINA_BASE=/ro ...
- 【js】用正则表达式对文字进行局部替换
比如有个字符串http://www.55188.com/thread-8306254-2-3.html,需要把8306254后面的2替换成其它数字,其它保持不变,该如何办呢?请看代码: var url ...
- Office WORD如何在图片上添加文字
如图所示,在图片格式中选择图片衬于文字下方即可,这样看起来感觉就像在图片上直接加字一样,没有生硬的感觉. 最终效果: Word如何在图片上添加文字Word如何在图片上添加文字Word如何在图片上添加文 ...
- android 随手记 仿微信的popwindow
/把文字控件添加监听,点击弹出自定义窗口 tv.setOnClickListener(new OnClickListener() { public void onClick(View v) { //实 ...
- MVC初识
一.MVC MVC模式(Model-View-Controller)将应用程序的实现分离的实现分离为三道不同的层: 模型层(Model): 视图层(View): 控制层(Controller): 二. ...