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 ;
}
HDU_1087_Super Jumping! Jumping! Jumping!_dp的更多相关文章
- HDU - 1087 Super Jumping!Jumping!Jumping!(dp求最长上升子序列的和)
传送门:HDU_1087 题意:现在要玩一个跳棋类游戏,有棋盘和棋子.从棋子st开始,跳到棋子en结束.跳动棋子的规则是下一个落脚的棋子的号码必须要大于当前棋子的号码.st的号是所有棋子中最小的,en ...
- 2012-2013 ACM-ICPC Northeastern European Regional Contest (NEERC 12)
Problems # Name A Addictive Bubbles1 addictive.in / addictive.out 2 s, 256 MB x438 B Blin ...
- Unity3D 第一人称控制器 C#脚本
CharacterMotor.cs using UnityEngine; using System.Collections; /** * @Author : www.xuanyusong.com */ ...
- Unity 之 c# 版的 CharacterMotor
using System; using System.Collections; using UnityEngine; // This class just convert from Character ...
- [ZPG TEST 109] 兔子跳跃【构图】
兔子跳跃 (jumping.pas/c/cpp) [问题描述] 兔子常常感到孤独,所以当他们决定出去走走,去见见他们的朋友,他们跳的很快. Iris正走在一条无限长的直线道路上.这条道路上点的编号.. ...
- VOC数据集 目标检测
最近在做与目标检测模型相关的工作,很多都要求VOC格式的数据集. PASCAL VOC挑战赛 (The PASCAL Visual Object Classes )是一个世界级的计算机视觉挑战赛, P ...
- 【Servlet】基于Jsp的微信Oauth2认证
作者:yongh701 挂载到微信服务器上的应用程序,能够通过微信Oauth2认证,能够抓取到用户的微信信息,当然,你首先要通过微信的帐号资质审核. 一.基本思想 二.基本过程 1.登陆微信的公众平台 ...
- Java学习笔记-基础语法Ⅳ
多态:同一个对象,在不同时刻表现出来的不同形态 例如: 猫 cat = new 猫(); 动物 animal = new 猫(); 这里的猫在不同时刻表现出来不同的形态,这就是多态 多态的前提和体现: ...
- E - Super Jumping! Jumping! Jumping!
/* Nowadays, a kind of chess game called "Super Jumping! Jumping! Jumping!" is very popula ...
随机推荐
- docker: useful commands
docker build -t stock_data_repo_instance24 . docker run -v /opt/log:/opt/log -d -it stock_data_repo_ ...
- 百度LBS云搜索时报错 "filter:area is not filteable field, please set property in the cloud-storage
{"status":2,"message":"filter:area is not filteable field, please set prope ...
- GammaRay观察Qt程序的运行状况
GammaRay是KDAB开发的Qt应用程序的软件内省工具.利用QObject内省机制,它允许您在运行时观察和操作应用程序.这既可以在工作站本地使用,也可以在嵌入式目标上远程使用. 通过扩充指令级调试 ...
- oc72--NSArray排序
// Person.h #import <Foundation/Foundation.h> @interface Person : NSObject @property (nonatomi ...
- influxdb入门——和mongodb一样可以动态增加字段
./influxd [--config yourconfigfile 2> /dev/null] 之所以重定向 因为默认log是stderr 再启动客户端./influx > CREAT ...
- bzoj 1036 树的统计Count
题目大意: 一棵树上有n个节点,编号分别为1到n,每个节点都有一个权值w 我们将以下面的形式来要求你对这棵树完成一些操作: I. CHANGE u t : 把结点u的权值改为t II. QMAX u ...
- luoguP2939 [USACO09FEB]改造路Revamping Trails
约翰一共有N)个牧场.由M条布满尘埃的小径连接.小径可 以双向通行.每天早上约翰从牧场1出发到牧场N去给奶牛检查身体. 通过每条小径都需要消耗一定的时间.约翰打算升级其中K条小径,使之成为高 速公路. ...
- bzoj1008 [HNOI2008]越狱——快速幂
题目:https://www.lydsy.com/JudgeOnline/problem.php?id=1008 (这样一道水题还因为忘记写 %lld WA了那么多遍) 发生越狱的状态数,就是全部状态 ...
- webrtc学习资源
http://www.imaotao.cn/project/webrtc-201604
- SpringBoot集成Mybatis配置动态数据源
很多人在项目里边都会用到多个数据源,下面记录一次SpringBoot集成Mybatis配置多数据源的过程. pom.xml <?xml version="1.0" encod ...