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): 32044 Accepted Submission(s): 14425
4 1 2 3 4
4 3 3 2 1
0
10
3
题解:求单调上升的序列和的最大值;简单动态规划:
代码:
import java.util.Scanner; public class hdu1087 {
public static void main(String[] argvs){
Scanner cin = new Scanner(System.in);
while(true){
int n = cin.nextInt();
if(n == )break;
int a[] = new int[n];
int dp[] = new int[n];
int ans = -0x3f3f3f3f;
for(int i = ; i < n; i++){
a[i] = cin.nextInt();
dp[i] = a[i];
for(int j = ; j < i; j++){
if(a[j] < a[i]){
dp[i] = Math.max(dp[j] + a[i], dp[i]);
}
}
ans = Math.max(ans, dp[i]);
}
System.out.println(ans);
}
}
}
Super Jumping! Jumping! Jumping!(dp)的更多相关文章
- hdu 1087 Super Jumping! Jumping! Jumping! 简单的dp
Super Jumping! Jumping! Jumping! Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 ...
- hdu 1087 Super Jumping! Jumping! Jumping!(动态规划DP)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1087 Super Jumping! Jumping! Jumping! Time Limit: 200 ...
- 【HDU - 1087 】Super Jumping! Jumping! Jumping! (简单dp)
Super Jumping! Jumping! Jumping! 搬中文ing Descriptions: wsw成功的在zzq的帮助下获得了与小姐姐约会的机会,同时也不用担心wls会发现了,可是如何 ...
- 杭电1087 Super Jumping! Jumping! Jumping!(初见DP)
Super Jumping! Jumping! Jumping! Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 ...
- HDU - 1087 Super Jumping!Jumping!Jumping!(dp求最长上升子序列的和)
传送门:HDU_1087 题意:现在要玩一个跳棋类游戏,有棋盘和棋子.从棋子st开始,跳到棋子en结束.跳动棋子的规则是下一个落脚的棋子的号码必须要大于当前棋子的号码.st的号是所有棋子中最小的,en ...
- HDU-1087-Super Jumping! Jumping! Jumping!(线性DP, 最大上升子列和)
Super Jumping! Jumping! Jumping! Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 ...
- Codeforces Round #598 (Div. 3) C. Platforms Jumping 贪心或dp
C. Platforms Jumping There is a river of width n. The left bank of the river is cell 0 and the right ...
- CodeForces - 512B Fox And Jumping[map优化dp]
B. Fox And Jumping time limit per test 2 seconds memory limit per test 256 megabytes input standard ...
- DP专题训练之HDU 1087 Super Jumping!
Description Nowadays, a kind of chess game called "Super Jumping! Jumping! Jumping!" is ve ...
- HDU 1087 Super Jumping! Jumping! Jumping! (DP)
C - Super Jumping! Jumping! Jumping! Time Limit:1000MS Memory Limit:32768KB 64bit IO Format: ...
随机推荐
- [RxJS] Logging a Stream with do()
To help understand your stream, you’ll almost always want to log out some the intermediate values to ...
- [Redux] Extracting Presentational Components -- Todo, TodoList
Code to be refactored: let nextTodoId = 0; class TodoApp extends Component { render() { const { todo ...
- 可失败构造器(Failable Initializers)
Xcode6.1中Swift的最新版本是1.1,在该版本中引入了一个新的特性:可失败构造器.通过构造器初始化实际上是给class或struct的每一个存储属性(参数)提供初始值,进行对象实例化的过程. ...
- WAS集群系列(6):集群搭建:步骤4:安装WAS升级软件
逐步点击"下一步",注意一处流程,例如以下列举: "升级软件"安装的路径设置,建议与之前的WAS及IHS安装的绝对路径同样,例如以下所看到的: 逐步点击,完毕安 ...
- 使用Qt Style Sheets制作UI特效
引言 作为一套GUI框架,Qt是非常强大的.(注:Qt 不仅是一套优秀的GUI框架,同时也是一套出色的应用程序框架).在UI的制作方面Qt为广大开发者提供了一套强大而易用的工具,她就是——Qt Sty ...
- SDK文件夹下内容介绍
Platform-Tools: 这是 adb, fastboot 等工具包.把解压出来的 platform-tools 文件夹放在 android sdk 根目录下,并把 adb所在的目录添加到系统 ...
- 512M内存机器如何用好Mysql
购买阿里云512M内存ECS后,mysql有时候会自动关闭,停止运行 解决办法: a,优化mysql配置,因为自己安装的是mysql 5.6,而从5.6开始,mysql安装包中不再包含my-small ...
- JavaScript语法学习笔记
1.关于执行JavaScript代码的方法: 第一种方法是将JavaScript代码放到文档<head>标签中的<script>标签之间: <head> & ...
- symfony2 登录验证(转自http://www.newlifeclan.com/symfony/archives/300)
注意:如果你需要为存储在某种数据库中的用户做一个登录表单,那么你应该考虑使用FOSUserBundle,这有助于你建立你的User对象,还为您提供了常见的登录.注册.忘记密码的路由和控制器. 在此文章 ...
- ubuntu 下搭建一个python3的虚拟环境(用于django配合postgresql数据库开发)
#安装python pip (在物理环境中安装) sudo apt-get install python-pip sudo apt-get install python3-pipsud ...