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: ...
随机推荐
- IOS的一个带动画的多项选择的控件(一)
先上效果图: 这个程序分2个层次,一个是顶部的带UITextField的bar,一个是下拉选择的view,下拉选择的view带有4个自己定义的UIView 我们先定义一个UIViewControlle ...
- Zedboard甲诊opencv图像处理(四)
接着上一篇博客,继续改进,现在为了是图像处理结果更加稳定,我实在没有办法了,只好先提取手指,再提取指甲. 把手指从背景里面提出来还是挺简单的,可惜的是我研究这么半天还是这结果,好沮丧. 怎么办呢,时间 ...
- this关键字的解析
this关键字的作用: 1.表示类中的属性. class Person{ // 定义Person类 private String name ; // 姓名 private int age ; // 年 ...
- [TypeScript] Avoid any type
To avoid using "any" type is a best pratice. The reason for that is it disable the power o ...
- 用SNMP协议实现系统信息监控--CentOS
(1) 安装SNMP客户端以及服务端 安装内容为三项:net-snmp net-snmp-devel net-snmp-utils 安装命令:yum install net-snmp net- ...
- 如何解决DE0-Nano的EPCS16 无法下载的问题:NO EPCS LAYOUT DATA --- LOOKING FOR SECTION [EPCS-XXXXXX]
在用NIOS的flashprogram对EPCSx进行烧录程序时,出现了No EPCS layout data --- looking for section [EPCS-XXXXXX]的错误,在网上 ...
- 无法从带有索引像素格式的图像创建graphics对象(转)
大家在用 .NET 做图片水印功能的时候, 很可能会遇到 “无法从带有索引像素格式的图像创建graphics对象”这个错误,对应的英文错误提示是“A Graphics object cannot be ...
- 注意:"AspNetPager”的控件“AspNetPager1”必须放在具有 runat=server 的窗体标记内
应加: <form id="form1" runat="server"> </form> 否则一开始什么也不显示,页面控件看不见,加上a ...
- IE8下载按钮失效
<input id="Button1" class="btn-lg-gary" type="button" onclick=" ...
- beini系列_2_beini装入虚拟机