HDU_1087_Super Jumping! Jumping! Jumping!_dp
Super Jumping! Jumping! Jumping!
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 32179 Accepted Submission(s): 14487
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
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
using namespace std; int num[];
int dp[]; int main()
{
int n;
while(scanf("%d",&n)!=EOF&&n)
{
int ans=;
memset(dp,,sizeof(dp));
for(int i=; i<=n; i++)
scanf("%d",&num[i]);
for(int i=; i<=n; i++)
for(int j=; j<i; j++)
{if(num[i]>num[j])
dp[i]=max(dp[i],dp[j]+num[i]);
if(ans<dp[i])
ans=dp[i];
}
printf("%d\n",ans);
}
return ;
}
最新文章
- python批量下载图片的三种方法
- DataTable插件指定某列不可排序
- Dojo特效(翻译)
- js获取网页的各种高度和宽度
- 重构17-Extract&#160;Superclass(提取父类)
- Delphi 712操作word
- 4.1 spring-alias 标签的解析;
- 一个类似于QQ语音聊天时的拖拽移动悬浮小球
- JavaScript多线程初步学习
- node.js 入门(一)安装
- VC学习笔记: 1. Window程序内部运行机制
- Java面向对象(封装性概论)
- BZOJ 1061: [Noi2008]志愿者招募 [单纯形法]
- 访问https 报错ssl 协议异常
- Unittest中TestCase类中定义的几个特殊方法
- C# 基础 new 、override实现多台区别
- C# 单例模式的五种写法
- linux系统编程之进程(六):父进程查询子进程的退出,wait,waitpid
- adb root : adbd cannot run as root in production builds
- kafka集群与zookeeper集群 配置过程
热门文章
- SiteMesh2-sitemesh.xml的ParameterDecoratorMapper映射器的用法
- CI 日志类
- Spring Web Flow 入门demo(二)与业务结合 附源代码
- UIView的层介绍
- Leetcode题解(5):L58/Length of Last Word
- SSD性能优化记录
- Java 定时任务之Quartz
- C语言控制台窗体图形界面编程(总结)
- CAGradientLayer功能
- Codeforces Round #250 (Div. 1) D. The Child and Sequence 线段树 区间求和+点修改+区间取模