Super Jumping! Jumping! Jumping!

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

点击打开链接

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[i] = max(num[i] , dp[j:(1~i-1)] + num[i])   	num[i] > num[j]
         dp[i]:以i结尾的数字可构成的最大和 

#include<cstdio>
#include<cstring>
#include<map>
#include<algorithm>
using namespace std;
#define INF 0x3f3f3f3f
//max,min,swap,unique
//dp[i]:以i结尾的数字可构成的最大和 

//   dp[i] = max(num[i] , dp[j:(1~i-1)] + num[i])   	num[i] > num[j]

int num[1000+5];
int dp[1005];		//表示以i结尾的子串的最大和 

int main()
{
	int n;
	while (~scanf ("%d",&n) && n)
	{
		for (int i = 1 ; i <= n ; i++)
			scanf ("%d",&num[i]);
		
		int ans = -INF;
		for (int i = 1 ; i <= n ; i++)
		{
			dp[i] = num[i];
			for (int j = 1 ; j < i ; j++)
			{
				if (num[i] > num[j])
					dp[i] = max(dp[i] , dp[j] + num[i]);
				ans = max(ans , dp[i]);
			}
		}
		printf ("%d\n",ans);
	}
	return 0;
}


MRI图像切片(nii格式转2D) 代码参考:将一个MRI(nii格式)数据进行切片 想要批量抽取MRI数据的几个切片,借鉴了上述代码的Python版本,原始代码抽取了全部切片。本次实验主要是抽取sMRI的横断面(axial)方向的其中30张切片,数量根据自己需求可自行设置。 import scipy, numpy, shutil, os, nibabel import sys, getopt import imageio def niito2D(filepath): inputfiles = os.listdir(filep 阅读详情

相关推荐

Transformer凭什么取代RNN?深入拆解自注意力机制与梯度消失问题的终极对决

本文深入探讨了Transformer如何通过自注意力机制解决RNN的梯度消失问题,成为自然语言处理领域的新标准。通过对比RNN和Transformer的架构差异,揭示了自注意力机制在并行计算、长期依赖处理等方面的技术优势,并提供了实际任务中的性能对比数据。

f6g7h8i9j的博客 191

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

【视频编码学习】AVS3参考软件HPM-4.1简单配置运行

1、用Visual Studio2017打开HPM-4.1文件夹 2、找到文件夹目录下x86_windows文件夹,因为是在win上运行该代码 3、然后找到对应vs版本(我当时2017版)的解决方案sln文件,双击打开可以看到该解决方案下的全部项目。 4、重新生成解决方案时发现提示sdk版本问题,所以右键点击所有的项目,选择重定向项目,修改一下sdk版本。 ...

谦虚勤奋诚实感恩 3100

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 consis

QYQHxyh的博客 258

OpenBmc开发2:构建开发环境

编译环境VMware + ubuntu 18.04 编译环境构建:参考OpenBmc开发1:构建开发环境 1、打开一个Ternimal,进入openbmc目录下 2、查看有哪些不同的编译配置 find meta-* -name local.conf.sample 可以看到如下编译配置 3、生成编译配置 插入TEMPLATECONF,上边查询到的配置有很多,但是有一些...

master 2万+

基于 Quest 摄像头数据开发的原理介绍【Unity Meta Quest MR 开发教程】

比如想在识别到的现实物体上叠加虚拟物体,需要知道这个现实物体在 Unity 的世界坐标下的哪个位置,是带有 x,y,z 三个轴的数据的。而 WebCamTexture 捕捉到的图像只是个 2D 的平面,没有三维世界的深度信息,我们通过物体识别算法识别到的物体坐标只是在这个 2D 平面上的一个屏幕坐标,可以理解为 Quest 拍摄了一张照片,我们识别到这张照片上的某个像素点为需要识别的现实物体的中心。是不是看起来比较复杂?Quest 的相机访问功能是在安卓的。

qq_46044366的博客 2105

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

优快云2082的博客 176

【STM32项目】基于stm32智能鱼缸控制系统的设计与实现(完整工程资料源码)

随着现代化经济的快速发展,物质条件富足的人开始追求精神富足,越来越多的人通过饲养观赏鱼来充实生活、释放压力,但并非所有饲养者都有时间和经验来管理好鱼缸。一种由单片机控制,可实时检测和调节鱼缸环境,可把鱼缸环境实时反映给用户并能被用户远程操控的系统,可以解决养鱼成活率低、耗费时间和精力、参与感不强等诸多难题。

嵌入式技术开发 7354

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

8、内存交织技术详解

本文详细解析了内存交织技术的基本原理、工作机制及实现方式,探讨了其在提升内存访问速度和系统性能中的关键作用。文章还分析了内存交织的优缺点、实际应用场景以及与其他优化技术的结合应用,并提出了未来发展的可能方向,为理解与运用该技术提供了全面参考。

g9h0i1的博客 553

在 MATLAB/Simulink 中构建一个卫星间激光通信链路的完整仿真系统

摘要: 本文通过Simulink详细演示了卫星间激光通信系统的建模过程,重点分析其在10Gbps高速率、2000km距离下的性能。系统设计涵盖PAM-4调制、自由空间信道建模(路径损耗、指向误差、多普勒效应)、APD探测及链路预算计算,并给出典型场景下18.5dB SNR、1e-9误码率的仿真结果。针对激光通信的μrad级指向精度挑战,提出AI辅助跟踪、混合RF/激光等优化策略,为未来太空高速组网提供可扩展的仿真框架。所需工具箱包括Communications Toolbox和Aerospace Toolb

xiaoheshang_123的博客 384

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

2025年华为杯中国研究生数学建模竞赛C题 围岩裂隙精准识别与三维模型重构 思路+代码

report += f"**位置 {i+1}**: ({loc[0]:.1f}, {loc[1]:.1f}, {loc[2]:.1f})\n"# ==================== 高级U-Net模型 ====================# ==================== 数据预处理与增强 ====================# ==================== 采样方法比较分析 ====================

YOLO 1528

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

ssm框架搭建

这个是一个在idea上成功跑起来的ssm框架项目,保存在这里方便以后使用直接下载

ET2012新版免狗免安装绿色软件

ET2012新版免狗免安祖昂绿色软件。,新界面,新视觉,

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

android 蓝牙通讯demo

android 下蓝牙通讯demo,实现了发现蓝牙,使能蓝牙,通过蓝牙发送消息。

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

titi2018815的博客 243

jdk-8u144-linux-x64.tar.gz.

该资源为搭建Linux系统Java环境用,资源的后缀为tar.gz格式的压缩包

hdu 1087 Super Jumping! Jumping! Jumping!

Super Jumping! Jumping! Jumping! Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 22532    Accepted Submission(s): 9916 Problem Descrip

小张的专栏 416

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

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

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

Alex_McAvoy的博客 730

Super Jumping! Jumping! Jumping! HDU - 1087

问题: 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 ...

lxxdong的博客 468
上一篇: WAJUEJI which home strong!
下一篇: 单调递增最长子序列(一)
☞十一
博客等级 码龄9年 8粉丝 57原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值