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): 34052 Accepted Submission(s): 15437
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<stdio.h>
#include<algorithm>
using namespace std;
const int maxn = ;
int num[maxn];
long long dp[maxn];
int main()
{
int n;
while(~scanf("%d",&n)&&n)
{
for(int i=;i<n;i++)
{
scanf("%d",num+i);
dp[i]=(long long )num[i];
} long long maxx=-0x3fffffff;
for(int i=;i<n;i++)
{
for(int j=;j<i;j++)
{
if(num[j]<num[i]) dp[i]=max(dp[i],dp[j]+num[i]);
}
maxx=max(maxx,dp[i]);
}
printf("%I64d\n",maxx); }
return ;
}
hdu 1087 Super Jumping! Jumping! Jumping! 简单的dp的更多相关文章
- HDU 1087 Super Jumping! Jumping! Jumping
HDU 1087 题目大意:给定一个序列,只能走比当前位置大的位置,不可回头,求能得到的和的最大值.(其实就是求最大上升(可不连续)子序列和) 解题思路:可以定义状态dp[i]表示以a[i]为结尾的上 ...
- 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!(求LSI序列元素的和,改一下LIS转移方程)
题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=1087 Super Jumping! Jumping! Jumping! Time Limit: 20 ...
- 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!
来源:点击打开链接 最长上升子序列的考察,是一个简单的DP问题.我们每一次求出从第一个数到当前这个数的最长上升子序列,直至遍历到最后一个数字为止,然后再取dp数组里最大的那个即为整个序列的最长上升子序 ...
- 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!(dp 最长上升子序列和)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1087 ------------------------------------------------ ...
- 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)
C - Super Jumping! Jumping! Jumping! Time Limit:1000MS Memory Limit:32768KB 64bit IO Format: ...
随机推荐
- Can't bind to local 8700 for debugger报错和解决
[2016-02-15 22:37:17 - ddms] Can't bind to local 8700 for debugger报错和解决 1.打开studio monitor是出错: Can't ...
- 常用iOS第三方库以及XCode插件介绍
第三方库 CocoaPod CocoaPod并不是iOS上的第三方库 而是大名鼎鼎的第三方库的管理工具 在CocoaPod没有出现之前 第三方库的管理是非常痛苦的 尤其是一些大型的库(比如nimbus ...
- ASM:《X86汇编语言-从实模式到保护模式》第12章:存储器的保护
12章其实是11章的拓展,代码基本不变,就是在保护模式下展开讨论. ★PART1:存储器的保护机制 1. 修改段寄存器的保护 当执行把段选择子传到段寄存器的选择器部分的时候,处理器固件在完成传送之前, ...
- sql server 行转列(转载)
SQL Server中行列转换 Pivot UnPivot PIVOT用于将列值旋转为列名(即行转列),在SQL Server 2000可以用聚合函数配合CASE语句实现 PIVOT的一般语法是:PI ...
- 【OpenCV】内存溢出
今天在写读大量图片时,发现在读到第721张时,内存溢出了,无法继续读.出错语句为pframe2 = cvLoadImage(pname2); 后来加上了ReleaseImage(&pname2 ...
- 22中编程语言的HelloWorld
C:printf("HelloWorld"); C++ : cout<<"HelloWorld"; QBasic : Print "Hel ...
- [Android] 查看Android中的AlarmManager事件
reference to : https://segmentfault.com/a/1190000000404684 有时候我们需要设置一个alarmmanager事件 但是如果这个事件的时间是凌晨三 ...
- Eclipse CDT launch failed.Binary not found in Linux/Ubuntu
转自:http://blog.csdn.net/abcjennifer/article/details/7573916 Linux下出现launch failed.Binary not found的解 ...
- cuda 初学大全
转自:http://blog.csdn.net/augusdi/article/details/12529331 cuda 初学大全 1 硬件架构CUDA编程中,习惯称CPU为Host,GPU为Dev ...
- 解决VS2010 C++ DLL不能断点调试的问题
问题产生的过程是这样的,向exe项目(CSharp)中添加dll工程(c++开发)的引用,并将引用工程的属性“Link Library Dependencies”的值设为true,这样,在不加入lib ...