hdu 1087 Super Jumping! Jumping! Jumping!(DP)

90+个各种疾病相关医疗数据集 含新冠、传染病、医学图像等 阅读详情

Super Jumping! Jumping! Jumping!

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 25057    Accepted Submission(s): 11073


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

题目链接:vhttp://acm.hdu.edu.cn/showproblem.php?pid=1087


题目大意:找出长度为n的序列的最大递增子序列和(数字不要求连续),如例一:递增子序列有(1,)(1,3)(3)(1,2)(2),和 最大的是(1,3),和为4。


题目解析:DP,dp[i]表示包含a[i]的,前i个数字组成的序列的最大递增子序列和。初始化dp[i]=a[i],找到前面比a[i]小的数a[j],态转移返方程为:dp[i]=max(dp[i],dp[j]+a[i]).

#include <cstdio>
#include <cstring>
const int maxn=1005;
int a[maxn],dp[maxn];  //dp[i]表示包含第i个数字的前i个位置的最大子序列和
int main()
{
    int n,i,j,max;
    while(scanf("%d",&n)!=EOF&&n)
    {
        for(i=0;i<n;i++)
            scanf("%d",&a[i]);
        max=dp[0]=a[0];
        for(i=1;i<n;i++)
        {
            dp[i]=a[i];   //初始化dp[i]
			for(j=i-1;j>=0;j--)
            {
                if(a[j]<a[i]&&a[i]+dp[j]>dp[i])  //状态转移方程:dp[i]=max(a[i]+dp[j],dp[i])
				{
                    dp[i]=dp[j]+a[i];    
					if(dp[i]>max)
					max=dp[i];
				}
            }
        }
        printf("%d\n",max);
    }
    return 0;
}


代码如下:


Windows加域迁移避坑指南:Profwiz工具实战中的5个常见问题与解决方案 本文详细解析了使用Profwiz工具进行Windows加域迁移时的5个常见问题及解决方案,包括临时配置文件生成、密码策略冲突、SID冲突等。通过实战案例和优化技巧,帮助IT运维团队高效完成账户配置文件迁移,确保Active Directory环境下的数据完整性和权限无缝衔接。 阅读详情

相关推荐

长短期记忆网络(LSTM)预测模型及其Python和MATLAB实现

LSTM 通过独特的门控机制解决了传统 RNN 的梯度消失和梯度爆炸问题,使其在处理长序列时具有显著优势。随着技术的不断发展,LSTM 及其变种(如 Bi-directional LSTM、Stacked LSTM 等)有望在更复杂的任务中发挥重要作用。2. **可视化真实值和预测值**:通过绘图来比较真实值和预测值,判断模型的准确性。2. **输入门(Input gate)**:决定当前的输入信息对细胞状态的影响。1. **细胞状态(Cell state)**:保持信息在时间步之间的传递。

qq_45441438的博客 2066

hdu1087 - 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): 20915    Accepted Submission(s): 9133 Problem Descripti

ITCTO-疯男的CSDN博客 564

[STM32H750]HAL库下FMC驱动正点原子MCU屏的移植与优化

本文详细介绍了在STM32H750平台上使用HAL库移植与优化正点原子MCU屏幕驱动的完整过程。重点解析了FMC硬件配置、Cache一致性处理、精确延时实现等关键技术难点,提供了实用的移植方案和性能优化技巧,帮助开发者高效解决屏幕显示问题。

rock5的博客 291

HDUOJ 1087 Super Jumping! Jumping! Jumping!

HDUOJ 1087 Super Jumping! Jumping! Jumping! 题目链接 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.

旺崽的博客 2688

USB2.0基础知识总结

目录 1、协议层: 1.1、域分类 1.2 、USB传输方式: 1、协议层: 域和包定义:包是一次传输的单位,每个包由多个域组成; USB中是按照LSB进行字节传输; 1.1、域分类 1.1.1: 同步域(SYNC field) 所有的包都开始于同步域,在低速和全速通信中SYNC field用7个0和1个1来表示。 由于USB2.0使用了NRZI编码(0用翻转来表示,1用不翻转表示),所以00000001就是上图那样。 ...

qq_32938605的博客 4417

金蝶云星空初级实施认证考题

Q4.[单选题] (1.5分) 总账中的多账簿账表主要是基于什么进行查看的Q47.[多选题] (2.5分) 销售订单的收款计划页签勾选预收之后,预收控制环节可以控制哪些节点?

m0_51994557的博客 3134

hdu 1087 Super Jumping! Jumping! Jumping!(dp)

hdu 1087 Super Jumping! Jumping! Jumping! http://acm.hdu.edu.cn/showproblem.php?pid=1087 ProblemDescription Nowadays,akindofchessgamecalled“SuperJumping!Jumping!Jumping!”isv...

diansitao5461的博客 95

Codex接入CCSwitch:本地代理与模型路由配置指南

在AI编程工具链中,本地代理与模型路由是连接智能体与模型服务的核心桥梁。Codex作为OpenAI推出的编程智能体,虽然具备强大的仓库理解和自主编码能力,但其默认模型链路固定,导致在多模型切换、内网统一管理及成本控制上存在天然瓶颈。CCSwitch正是为解决这一痛点而生的本地代理工具,它通过OpenAI兼容协议将Codex的请求透明转发至DeepSeek、通义千问等第三方模型服务,使模型切换如同点击按钮般简单。本文从本地代理和模型路由器的基础原理切入,系统讲解Codex与CCSwitch的安装配置、模型ID

weixin_33910460的博客 437

hdu-1087 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 K (Java/Others)Total Submission(s): 35239

oYinGui1 837

Python 爬虫进阶技巧:新手必学的反爬突破与效率优化

本文系统总结了爬虫进阶的核心技巧,针对新手常见的反爬拦截、效率低下、动态页面解析等痛点问题,提出了可落地的解决方案。主要内容包括:通过随机UA池、代理IP池和Cookie池突破常见反爬机制;利用多线程/异步请求提升爬取效率;使用Selenium解析动态渲染页面;以及数据清洗方法提升数据质量。文中提供了完整的代码示例和实战对比数据,并强调爬虫开发应遵守合规性要求。这些技巧能帮助开发者快速提升爬虫实战能力,应对80%以上的常见爬取需求。

2503_91057718的博客 1440

30天入门 SAP BTP 开发系列之四:SAP BTP 控制台里 Global Account 的常规操作介绍

笔者前一篇文章,介绍了 SAP BTP 中 Global Account 的概念。本文咱们一起来看看 SAP BTP 控制台里,给 Global Account 开放了哪些操作功能。

2007 年 ~ 2025 年,深耕 SAP 技术 18 年 878

HDU 1087 - Super Jumping! Jumping! Jumping!

题目链接:HDU - 1087 Super Jumping! Jumping! Jumping! Time Limit: 2000/1000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others) ...

Ripcord丶的博客 189

【01】总目录——软件设计师50讲通关地图|从零基础到工程师职称

本文是《软件设计师·50讲通关|从零基础到工程师职称》专栏的01篇总目录,系统梳理了50篇博文的完整架构与核心逻辑。专栏覆盖软考软件设计师(中级)全部考点,分为导学规划、基础知识、设计模式、下午题专项、算法实战、冲刺模拟、收官进阶七大模块,既兼顾上午题75道单选题的理论攻坚,也聚焦下午题案例分析的解题能力提升。每篇博文均包含考点精讲、真题解析、实战技巧与速记方法,配套可运行代码、解题模板及备考资源。无论你是零基础转行、在校学生还是在职程序员,都能通过这份学习地图明确进度、精准定位薄弱环节,高效搭建知识体系

专注于人工智能、软件开发、工控自动化、工厂数字化及智能化等领域,希望和大家共同进步! 1292

HDU1087 Super Jumping! Jumping!(dp)

HDU1087 Super Jumping! Jumping! (TEST<32> 11.25) 解题思路 dp就是求前面的每一个位置的最大值然后依次往后更新 太菜了 ,看着以前的模板才 AC出来… AC 代码如下 #include<iostream> #include<algorithm> #include<cstring> using names...

MaxVen 170

NTscan扫描工具

ntscan是一个扫描器,可以扫描没有密码和弱密码的共享,先到配置文件中填写猜测的用户名和密码,扫描过程中右侧出现的是扫描日志。

WINCC7.3破解文件

WINCC7.3硬件够破解文件,有需要的下载!WINCC7.3硬件够破解文件,有需要的下载!

杭电 1087 hdu (Dynamic Programming)Super Jumping! Jumping! Jumping!

杭电 1087 hdu (Dynamic Programming) Super Jumping! Jumping! Jumping! *Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 66856 Accepted Submission(s): 31301* Problem Description Nowadays, a kind of chess g

邓汪涛的博客 255

复分析 阿尔福斯(Ahlfors) 第三版答案 英文

答案分为十章,有部分习题没有答案,全英文复分析阿尔福斯(Ahlfors) 第三版答案

Super Jumping! Jumping! Jumping!【基础DP】

题目链接:HDU-1087 kuangbin带你飞【专题十二 基础DP1 】 题目描述: 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...

Hang_ccccc的博客 265

最新的sdio 4.0 spec 协议标准 带书签 高清完整PDF版

Part-E1-SDIO-Specification-Ver4.00-Final-120220.pdf:最新的sdio 4.0 spec 协议标准 带书签 高清完整PDF版,包括SDIO 接口的外设,SDIO 接口官方协议等。

HDU-1087 Super Jumping! Jumping! Jumping!

动态规划 HDU-1087 Super Jumping! Jumping! Jumping! 题目链接: 杭电1087 题目大意: 给定一列数字 求最大顺序子列和 子列中的数字必须严格由小到大 解题思路: 将数组储存 dp[i]储存以arr[i]为结尾的最大值 循环当前判断的前面的数字 如果当前的数字比之前的数字大 则进行dp的替换 方程为:dp[i] = max(dp[i], dp[j]...

鱼头的水题之路 301

HDU - 1087 Super Jumping! Jumping! Jumping!

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 c...

zamaochick的博客 396

HDU - 1087 Super Jumping! Jumping! Jumping! (DP)

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 ...

洛 水 145

HDU 【1087】Super Jumping! Jumping! Jumping

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 yo

进击的小白 207

HDU1087:Super Jumping! Jumping! Jumping!(上升子序列最大和)

HDU1087:Super Jumping! Jumping! Jumping! kuangbin专题十二:E题 Time Limit: 2000/1000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 41625Accepted Submission(s):...

aboc43983的博客 153

B - Super Jumping! Jumping! Jumping! HDU - 1087(dp)

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...

莉莉莉的博客 391

HDu1087 Super Jumping! Jumping! Jumping!

题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1087 分析:简单dp;dp[i] = max (dp[i], dp[j] + a[i]) 1 #include<iostream> 2 #include<sstream> 3 #include<cstdio> 4 #include&l...

weixin_30449453的博客 84

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): 35625    Accepted Submission(s): 16206 Problem Descri

Puya的博客 308

HDU - 1087 Super Jumping! Jumping! Jumping!

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 c...

GJLfly的博客 281

Hdu 1087 Super Jumping! Jumping! Jumping!

Hdu 1087 Super Jumping! Jumping! Jumping! 题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1087 解题思路:用dp数组记录到i位的最长上升序列的和,每一步往前找前置最大的符合题意的结果,转移方程dp[i]=max(dp[i],dp[j]+num[i]); 代码如下: #include <bits/st...

weixin_43823753的博客 175
上一篇: hdu 1166 敌兵布阵(线段树)
下一篇: hdu 1231 最大连续子序列(DP)
雨狮子
博客等级 码龄12年 24粉丝 185原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值