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: ...
随机推荐
- 如何将XML转换成XSD(XML Schema)文件
将xml装换为xsd,先决条件是已经安装了Visual Stutio 1) 输入cmd在运行窗口 2) 将xsd的路径加入到path变量 set path=%path%;C:\Program File ...
- float position的測试案例
依据<a target=_blank href="http://blog.csdn.net/goodshot/article/details/44348525">htt ...
- POJ 1322 Chocolate
Chocolate Time Limit: 2000MS Memory Limit: 65536K Total Submissions: 8245 Accepted: 2186 Speci ...
- Oracle用户解锁的三种办法及默认的用户与密码
ORA-28000: the account is locked-的解决办法 2009-11-11 18:51 ORA-28000: the account is locked 第1步:使用PL/SQ ...
- Sass函数--颜色函数--Opacity函数
Opacity函数简介 在 CSS 中除了可以使用 rgba.hsla 和 transform 来控制颜色透明度之外,还可以使用 opacity 来控制,只不过前两者只是针对颜色上的透明通道做处理,而 ...
- 软件工程师所需掌握的“终极技术”是什么?
软件工程师所需掌握的"终极技术"是什么? http://yunli.blog.51cto.com/831344/1019990 最近,我在微博上看到@程序员邹欣老师发的一条微博 - ...
- 提高jQuery执行效率
1. 使用最新版本的jQuery jQuery的版本更新很快,你应该总是使用最新的版本.因为新版本会改进性能,还有很多新功能. 下面就来看看,不同版本的jQuery性能差异有多大.这里是三条最常见的j ...
- LNMP优化
LNMP优化 LNMP优化从系统安全,系统资源占用率,及web服务并发负载这三个方面体现,并 且主要体现在web服务并发负载这一方面. 1:首先进行linux优化加固 Linux ...
- linux 虚拟机centos64位_6.5+VM10 主机是固定IP局域网设置代理上网,虚机设置固定ip 图文详细步骤
一种: 虚机是Desktop 安装 1.虚拟机—设置—网络适配器子选项—选择“桥接模式” 2.在虚拟机中选择系统(System)—首选项(Preferences)—网络连接(Network Conne ...
- 1、solr 查询
solr查询参数: q 查询的关键字,此参数最为重要,例如,q=id:1,默认为q=*:*, fl 指定返回哪些字段,用逗号或空格分隔,注意:字段区分大小写,例如,fl= id,title,sor ...