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. 微软消息队列MessageQueue(MQ)

    首先本地安装微软的消息队列服务器. 基础类: namespace Core.MessageQueueTest { public class TestQueue : IDisposable { prot ...

  2. JAVA 网络长短连接

       作为java的刚開始学习的人,看了网上的资料后,关于java的长短连接,感觉理解的不是非常深刻.结合自己的学习和网上的资料整理例如以下.不对之处请大家批评指正.                  ...

  3. linux 磁盘性能监控

    linux下对于查看进程的命令非常多也非常强大.经常使用的如:ps  top 可是在磁盘性能监控方面就没有那么统一了. 以下列举一些磁盘监控命令.此处仅仅是起到抛砖引玉作用,具体使用參数请參考man手 ...

  4. 【转】Android使用XML Shape绘制带阴影效果的圆形按钮

    众所周知,在Android开发里,为了优化在各种分辨率设备上的显示效果,同一份图片素材往往要提供mdpi.hdpi.xhdpi三种(以前还有ldpi), 尤其是按钮类的素材,考虑到normal.pre ...

  5. electron利用nodejs+移动端技术跨平台桌面应用开发框架——记录下,类似node webkit!

    Build cross platform desktop appswith JavaScript, HTML, and CSS Electron: 1.6.8Node: 7.4.0Chromium:  ...

  6. bzoj1977 [BeiJing2010组队]次小生成树 Tree——严格次小生成树

    题目:https://www.lydsy.com/JudgeOnline/problem.php?id=1977 因为严格,所以要记录到 LCA 的一个次小值: 很快写好,然后改掉一堆错误后终于过了样 ...

  7. RDA 字库制作

    制作韩语字库为例: 1.韩语UNICODE 范围 TV_IDF_uni_korean.txt [01fa,] [02c6,02c7] [02c9,02ca] [02cd,02cd] [02d8,02d ...

  8. bzoj1477 && exgcd学习笔记

    exgcd 由于忘记了exgcd,这道题就没做出来... exgcd的用处是求ax+by=gcd(a,b)这样方程的解 大概是这个样子的 void ext_gcd(long long a, long ...

  9. shell脚本-数组

    shell脚本-数组 数组 变量:存储单个元素的内存空间. 数组:存储多个元素的连续的内存空间,相当于多个变量的集合. 数组索引:编号从0开始,属于数值索引.索引可支持使用自定义的格式,而不仅是数值格 ...

  10. PCB 720全景图嵌入登入界面应用实现

    通常软件主界面或登入界面背景图片通常采用固定图片,这里介绍如何将720度全景图嵌入到登入界面中来, 这里用的素材来源于这里上个月在公司里拍摄的全景图, 一.拍摄720度全景图片, 建议:最好用三角固定 ...