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 ...
随机推荐
- Ubuntu 16.04安装XMind 8
下载: http://www.xmind.net/download/linux/ 解压 sudo unzip xmind-8-update2-linux.zip -d xmind8 移动到/opt目录 ...
- Spring Cloud ZooKeeper集成Feign的坑2,服务调用了一次后第二次调用就变成了500,错误:Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is com.n
错误如下: 2017-09-19 15:05:24.659 INFO 9986 --- [ main] s.c.a.AnnotationConfigApplicationContext : Refre ...
- mysql limit具体用法
MYSQL中LIMIT用法_百度知道 答 limit是mysql的语法select * from table limit m,n其中m是指记录开始的index,从0开始,表示第一条记录n是指从第m+1 ...
- Linux网络编程:UDP Socket编程范例
TCP协议提供的是一种可靠的,复杂的,面向连接的数据流(SOCK_STREAM)传输服务,它通过三段式握手过程建立连接.TCP有一种"重传确认"机制,即接收端收到数据后要发出一个肯 ...
- LeetCode 447. Number of Boomerangs (回力标的数量)
Given n points in the plane that are all pairwise distinct, a "boomerang" is a tuple of po ...
- jeasyui-datagrid使用笔记
formatter转换ID为值 设置字典缓存 var DictionaryItem = {}; $.post('/Dictionary/GetDictionary/T_RKXD', function ...
- [Codeforces Round49F] Session in BSU
[题目链接] http://codeforces.com/contest/1027/problem/F [算法] 二分图匹配 [代码] #include<bits/stdc++.h> #p ...
- JSP-Runoob:JSP 日期处理
ylbtech-JSP-Runoob:JSP 日期处理 1.返回顶部 1. JSP 日期处理 使用JSP最重要的优势之一,就是可以使用所有Java API.本章将会详细地讲述Java中的Date类, ...
- hibernate缓存机制详细分析(一级、二级、查询缓存,非常清晰明白)
本篇随笔里将会分析一下hibernate的缓存机制,包括一级缓存(session级别).二级缓存(sessionFactory级别)以及查询缓存,当然还要讨论下我们的N+1的问题. 随笔虽长,但我相信 ...
- Scala 返回多个值
class A{ var c var d def return={ (c,d,"soyo") //以元组形式返回 }}调用: val s=new A var(a1,a2,a3)=s ...