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

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... 阅读详情

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.



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
 
  这个题目意思就是求出一组序列的最长上升子序列,然后求得这个最长上升子序列的和,那么,这题是比较经典的dp问题,那么,这题的动态转移方程为:
  dp[i] = max(dp[i],dp[j]+a[i]) (a[j] < a[i])  这题已经AC了,请参考下面的具体代码: 
#include <stdio.h>
#include <string.h>

int a[1000];
int dp[1000];

int main()
{
	int n;
	while(scanf("%d",&n),n)
	{
		for(int i = 0; i < n; i++)
		{
			scanf("%d",&a[i]);
			dp[i] = a[i];
		}
		int max = dp[0];
		for(int i = 1; i < n; i++)
		{
			for(int j = 0; j < i; j++)
			{
				if(a[j] < a[i]&&dp[j]+a[i] > dp[i])
				{
					dp[i] = dp[j] + a[i];
				}
			}
			if(max < dp[i])
			max = dp[i];
		}
		printf("%d\n",max);
	}
	return 0;
}
STM32F103C8T6 + GY-906红外测温:手把手教你用CubeMX和HAL库搞定IIC驱动(附完整工程) 本文详细介绍了如何使用STM32F103C8T6和GY-906红外测温传感器(基于MLX90614芯片)实现非接触式温度测量。从STM32CubeMX工程创建、HAL库驱动适配到温度数据采集与处理,提供完整的开发流程和常见问题解决方案,帮助开发者快速掌握红外测温技术。 阅读详情

相关推荐

AT32F435/437开发实战:把SD卡变成U盘的完整指南(含源码解析)

本文提供了基于AT32F435/437微控制器将SD卡改造为U盘的完整实战指南。通过深入解析USB MSC协议与SDIO驱动的协同工作原理,详细介绍了硬件设计要点、软件架构融合、核心源码解析以及从编译到文件传输的完整调试流程,帮助开发者实现可靠的大容量存储设备扩展。

weixin_29159127的博客 409

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-疯男的优快云博客 563

模型量化必知:Per-Tensor和Per-Channel到底怎么选?

本文深入解析了模型量化中Per-Tensor与Per-Channel两种核心策略的抉择。Per-Tensor量化实现简单、硬件兼容性极佳,适合激活值或分布均匀的权重;而Per-Channel量化精度更高,能更好地处理权重分布不均的卷积层,是现代CNN权重量化的主流。文章提供了从硬件平台、数值分布到精度需求的实战决策框架,并推荐了“权重Per-Channel,激活Per-Tensor”的混合量化最佳实践。

assembly8low的博客 983

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的博客 94

Mind+掌控板实战:5分钟搞定Easy IoT的MQTT通讯(附完整代码)

本文详细介绍了如何利用掌控板和Mind+图形化编程软件,快速实现基于Easy IoT平台的MQTT通讯。通过清晰的步骤讲解和完整的代码示例,指导用户完成从云端配置、Wi-Fi连接到MQTT消息发布与订阅的全过程,帮助初学者轻松构建物联网设备间的双向对话系统。

weixin_29300241的博客 445

【UE5】UE5 Dedicated Server专用服务器与网络同步

这篇文章是个人在学习UE4的网络同步方面的内容的一些记录,因为UE5出来了,顺带也一起熟悉熟悉UE5,所以也就直接使用UE5来实践了。说句实在话,UE4网络同步这块确实挺难的,我自己在网上搜索的博客的内容要么停留在很浅层面只搭建一个ds服务器,要么就直接深入源码去剖析UE4的网络机制,处在中间层面的内容少之又少,不得不自己好一阵研究,强烈推荐这几位博主的博文,我在学习的过程中也从中受益匪浅。 Ken_An、风蚀之月、 刘东无敌还有我师傅推荐给我的一本关于UE4网络的PDF。 一、什么是Dedicated

Goulandis 3万+

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 832

Ollama运行DeepSeek大模型调优指南:GPU与CPU协同实现性能最大化

Ollama运行DeepSeek大模型调优指南

qq_32358423的博客 3994

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

Eplan P8自动线号生成全攻略:从电位定义点到连接编号的完整流程

本文详细解析了Eplan P8自动线号生成的全流程,从电位定义点的创建配置到连接编号的标准化管理,帮助电气设计人员提升图纸规范性和工作效率。重点介绍了自动编号方案的定义与调整技巧,以及企业级标准化实施建议,是掌握Eplan P8自动线号功能的实用指南。

weixin_29254029的博客 509

uniapp [全端兼容] - 详细实现接入使用海康威视监控云端显示及控制功能,网站集成安装海康监控及实时监控显示、摄像头控制,实时推流、回放、放大缩小画面、视频画面截图、截屏抓拍及播放器解决延迟教程

uniapp,h5移动端网页,微信小程序,支付宝小程序,Android安卓,苹果ios,app,nvue,vue,海康威视,海康监控,摄像头监控,实时监控画面,海康插件,无法连接,报错,uniApp对接海康处理接口认证规则,监控实时预览和回放功能,海康api接口,安全认证,海康开放平台,官方文档,播放海康摄像头的监控视频,海康实时监控播放详细步骤,web,黑屏,视频播放,回放,视频流地址,取流协议,视频sdk播放,hik,rtsp,rtmp,hls,ws,网站,网页,h5页面,后台管理系统,对接海康监控设备

🏆 前端领域优质创作者 1万+

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

深入Scrapy ItemLoader:打造优雅高效的Python爬虫数据清洗流水线

ItemLoader是 Scrapy 提供的声明式数据加载工具。它的核心理念是:将数据提取(从response中取原始值)和数据清洗/验证(处理空值、格式转换、默认值等)分离开。你可以把它想象成一个工厂流水线:原始零件(selector提取的文本)进入,经过一道道工序(输入处理器),组装成最终产品(Item字段)。首先在items.py中定义清晰的数据结构。使用搭配类型注释(虽然Scrapy自身不强制,但对人和IDE友好)。

2201_76125261的博客 68

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丶的博客 188

Outlook Express 6 (OE6) for Win7/Win8/Win10

英文版 Outlook Express6.0, 兼容Win7/Win10/WinXP,解压就可用。

老版QQ原生表情gif动态

这是老版的QQ表情,不过全是动态的的,Windows照片查看器是不会动的,可以右击用浏览器打开查看,再说一遍是老版的,只是分享给宁愿用老版也要动态的人。

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 169

汉书HE8,好用的汇编代码编写工具

汉书HE8,好用的汇编代码编写工具早期编写汇编代码所用功能强大

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 can be played by two or more than two players. It consists of

Lionel 2068

VC中sqlite的使用

在VC中对sqlite的使用,实现数据库大批数据的快速插入,读取数据库中的数据在ListCtrl中显示

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

洛 水 144

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

莉莉莉的博客 390

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的博客 395

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

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! (DP)

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

robin_8的博客 305

【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): 33875    Accepted Submission(s): 15345 Problem Descri

Bear1998的博客 318

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的博客 280

HDU 1087 Super Jumping! Jumping! Jumping! 【DP】

题目来源:http://acm.hdu.edu.cn/showproblem.php?pid=1087 ★题目不难,但是菜鸡走向不菜的必写之题qwq 翻译: 翻译来自 kuangbin的基础DP训练 ,不知道是谁翻译的awa 翻译的貌似不是原题,大巨巨们的脑洞太大 ,编了个故事。8说了,敲就完事了~ 思路: 这题不需要多说叭,就是求递增子序列的最大和,dp解决 动态转移方程:dp[i]=ma...

HungTeen的博客 261

【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): 33314    Accepted Submission(s): 15063

wyg1997 391
上一篇: NYOJ - 1的个数
下一篇: HDU - Palindrome(dp)
SevenMIT
博客等级 码龄15年 60粉丝 162原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值