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

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.

 
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.
 
Output
For each case, print the maximum according to rules, and one line one case.
 
Sample Input
3 1 3 2
4 1 2 3 4
4 3 3 2 1
0
 
Sample Output
4
10
3
 
简单dp。
 
#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的更多相关文章

  1. HDU - 1087 Super Jumping!Jumping!Jumping!(dp求最长上升子序列的和)

    传送门:HDU_1087 题意:现在要玩一个跳棋类游戏,有棋盘和棋子.从棋子st开始,跳到棋子en结束.跳动棋子的规则是下一个落脚的棋子的号码必须要大于当前棋子的号码.st的号是所有棋子中最小的,en ...

  2. 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 ...

  3. Unity3D 第一人称控制器 C#脚本

    CharacterMotor.cs using UnityEngine; using System.Collections; /** * @Author : www.xuanyusong.com */ ...

  4. Unity 之 c# 版的 CharacterMotor

    using System; using System.Collections; using UnityEngine; // This class just convert from Character ...

  5. [ZPG TEST 109] 兔子跳跃【构图】

    兔子跳跃 (jumping.pas/c/cpp) [问题描述] 兔子常常感到孤独,所以当他们决定出去走走,去见见他们的朋友,他们跳的很快. Iris正走在一条无限长的直线道路上.这条道路上点的编号.. ...

  6. VOC数据集 目标检测

    最近在做与目标检测模型相关的工作,很多都要求VOC格式的数据集. PASCAL VOC挑战赛 (The PASCAL Visual Object Classes )是一个世界级的计算机视觉挑战赛, P ...

  7. 【Servlet】基于Jsp的微信Oauth2认证

    作者:yongh701 挂载到微信服务器上的应用程序,能够通过微信Oauth2认证,能够抓取到用户的微信信息,当然,你首先要通过微信的帐号资质审核. 一.基本思想 二.基本过程 1.登陆微信的公众平台 ...

  8. Java学习笔记-基础语法Ⅳ

    多态:同一个对象,在不同时刻表现出来的不同形态 例如: 猫 cat = new 猫(); 动物 animal = new 猫(); 这里的猫在不同时刻表现出来不同的形态,这就是多态 多态的前提和体现: ...

  9. E - Super Jumping! Jumping! Jumping!

    /* Nowadays, a kind of chess game called "Super Jumping! Jumping! Jumping!" is very popula ...

随机推荐

  1. Spring/Maven/MyBatis配置文件结合properties文件使用

    使用properties文件也叫注入,比如把一些常用的配置项写入到这个文件,然后在Spring的XML配置文件中使用EL表达式去获取. 这种方式不只Spring可以使用,同样MyBatis也可以使用, ...

  2. Cocos2d-x 3.x 图形学渲染系列十一

    笔者介绍:姜雪伟.IT公司技术合伙人,IT高级讲师,CSDN社区专家,特邀编辑,畅销书作者,国家专利发明人;已出版书籍:<手把手教你架构3D游戏引擎>电子工业出版社和<Unity3D ...

  3. 如何下载youtube的视频

    1 登陆以下网址,输入视频地址,点击Download,然后右下角出现了链接,点击即可下载 http://en.savefrom.net/

  4. 喷水装置(一)(南阳oj6)(简单贪心)

    喷水装置(一) 时间限制:3000 ms  |  内存限制:65535 KB 难度:3 描写叙述 现有一块草坪,长为20米.宽为2米.要在横中心线上放置半径为Ri的喷水装置.每一个喷水装置的效果都会让 ...

  5. Wincc操作数据库SQLSERVER

     WINCC写数据库 在WINCC的图形编辑器中,在输入域的属性中.选择事件.再选择键盘的释放动作,在动作代码框中写下例如以下代码: Dim conn,rs Dim strsql Dim a a=HM ...

  6. 王立平--SQLite,SQLiteOpenHelper的简单应用

    Android平台提供给我们一个数据库辅助类来创建或打开数据库,这个辅助类继承自SQLiteOpenHelper类.在该类的构造器中,调用Context中的方法创建并打开一个指定名称的数据库对象.继承 ...

  7. s:actionmessage页面样式失效

    1,  s:actionmessage页面样式失效: 2,解决方式: 将样式直接写入s:actionmessage标签中:<span><s:actionmessage cssSt ...

  8. mysql20170407代码实现

    今天用了一会儿sqlyog,感觉还是会让人懒惰,所以选择了ms-dos环境,感觉不错,原生态,敲着很爽; | test01 | | tree | | world | +---------------- ...

  9. 我的Android进阶之旅------&gt;Android关于ImageSpan和SpannableString的初步了解

    近期要实现一个类似QQ聊天输入框.在输入框中能够同一时候输入文字和表情图像的功能.例如以下图所看到的的效果: 为了实现这个效果.先去了解了一下ImageSpan和SpannableString的使用方 ...

  10. raid5什么意思?如何做raid5?raid5 几块硬盘?

    raid5什么意思?如何做raid5?raid5 几块硬盘? 分类: 项目管理2012-09-28 00:38 5326人阅读 评论(0) 收藏 举报 一.raid什么意思?RAID是“Redunda ...