Super Jumping! Jumping! Jumping!(求最长递增子序列之和)
来源:互联网 发布:六边形战士知乎 编辑:程序博客网 时间:2024/05/21 06:35
Super Jumping! Jumping! Jumping!
Time Limit : 2000/1000ms (Java/Other) Memory Limit : 65536/32768K (Java/Other)
Total Submission(s) : 16 Accepted Submission(s) : 9
Problem Description
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.
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
Input contains multiple test cases. Each test case is described in a line as follow:
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.
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
For each case, print the maximum according to rules, and one line one case.
Sample Input
3 1 3 24 1 2 3 44 3 3 2 10
Sample Output
4103#include<iostream>#include<algorithm>using namespace std;int main(int ac,char *av[]){ int n,i,j,arr[1002],dp[1002]; while(cin>>n,n) { int max_v=-999999; for(i=1;i<=n;i++) cin>>arr[i]; for(i=1;i<=n;i++) { dp[i]=arr[i]; for(j=1;j<i;j++) if(arr[j]<arr[i]) dp[i]=max(dp[i],dp[j]+arr[i]); max_v=max(max_v,dp[i]); } cout<<max_v<<endl; } return 0;}
- Super Jumping! Jumping! Jumping!(求最长递增子序列之和)
- hdu 1087 Super Jumping! Jumping! Jumping! (动态规划,求最长子序列之和)
- Super Jumping! Jumping! Jumping! (最长子序列)
- HDU 1087 Super Jumping! Jumping! Jumping!(求绝对递增子序列的最大和)
- hdu1087 Super Jumping! Jumping! Jumping! (求最大递增子序列和)
- hdu 1087 Super Jumping! Jumping! Jumping!(dp+最长递增序列)
- HDU 1080-Super Jumping! Jumping! Jumping!(LIS最长上升子序列-最大递增子段和)
- HDU 1087--Super Jumping! Jumping! Jumping!【最长递增子序列的和】
- Super Jumping! Jumping! Jumping! hdu1087 最长有序子序列
- HDU 1087 Super Jumping! Jumping! Jumping!最长上升子序列
- HDU1087 Super Jumping! Jumping! Jumping!【最长上升子序列+DP】
- hdu1087 - Super Jumping! Jumping! Jumping! (dp 求递增子序列的最大和)
- hdoj--1087--Super Jumping! Jumping! Jumping!(最长上升序列)
- hdu 1087 Super Jumping! Jumping! Jumping! (最大递增子序列和)
- hdu1087——Super Jumping! Jumping! Jumping!(最大递增子序列和)
- hdu 1087 Super Jumping! Jumping! Jumping!(最大上升子序列之和)
- hdu 1087 Super Jumping! Jumping! Jumping!(最长上升子序列变形)
- hdu 1087 Super Jumping! Jumping! Jumping!(dp 最长上升子序列和)
- 宏的副作用
- Android蓝牙通信功能开发 .
- AS3的工具类库
- struts2框架下用ajax实现网页局部刷新
- webgame的文件储存方案 .
- Super Jumping! Jumping! Jumping!(求最长递增子序列之和)
- paste ur image
- oracle移动文件的两种方法
- Back 键与Home键
- JSFL 非官方不完全手册[转]
- Qt商业版下载地址
- 软件开发项目规划时,SA、SD与SE的区别与重要性
- 与C++共处的日子
- PHP Debug (基础配置)