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 ...
随机推荐
- java ee标准DataSource理解
- Unity3D Asset文件导出3DMax 可编辑格式
本文章由cartzhang编写,转载请注明出处. 全部权利保留. 文章链接:http://blog.csdn.net/cartzhang/article/details/60878354 作者:car ...
- 如何定义StrokeIt手势 常用StrokeIt手势大全
1 最小化,最大化,最小化所有(显示桌面) 斜向上表示最大化或者还原,斜向下表示最小化,适用于任务管理器和一般应用程序(有这三个按钮的都可以),先斜向下再斜向上表示显示桌面,这个在WIN7系统中不太实 ...
- Python中range和xrange的异同之处
range 函数说明:range([start,] stop[, step]).依据start与stop指定的范围以及step设定的步长,生成一个序列. range演示样例: >> ...
- Intellij热部署插件JRebel使用方法(转载)
Intellij热部署插件JRebel帮助开发者在项目处于运行状态下任意修改Java文件并动态反馈到运行的项目中.插件官方下载地址:https://plugins.jetbrains.com/plug ...
- ios7--UIImageView
// // ViewController.m // 03-UIImageView的使用 // #import "ViewController.h" @interface ViewC ...
- 大文件Copy 大数据量复制
private void button3_Click(object sender, EventArgs e) { Thread thread ...
- P1552 派遣 左偏树
左偏树就是一个应该用堆维护的区间,然后需要进行合并操作而发明的算法,其实这个算法没什么难的,和树剖有点像,维护几个数值,然后递归回来的时候就可以修改. 题干: 题目背景 在一个忍者的帮派里,一些忍者们 ...
- 洛谷[USACO06JAN]把牛Corral the Cows
题目描述 约翰打算建一个围栏来圈养他的奶牛.作为最挑剔的兽类,奶牛们要求这个围栏必须是正方 形的,而且围栏里至少要有C< 500)个草场,来供应她们的午餐. 约翰的土地上共有C<=N< ...
- SPOJ - QMAX3VN (4350) splay
SPOJ - QMAX3VN 一个动态的序列 ,在线询问某个区间的最大值.关于静态序列的区间最值问题,用ST表解决,参考POJ 3264 乍一看上去 splay可以轻松解决.书上说可以用块状链表解决, ...