hdu1087 Super Jumping! Jumping! Jumping!(DP)

HDU 动态规划(46道题目 立即下载

Super Jumping! Jumping! Jumping!

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


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
 

Author
lcy
/*
题目挺好的。加油!!!
Time:2015-4-6 18:04
*/
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
const int MAX=1010;
int main(){
    int dp[MAX],a[MAX];
    int n;
    while(scanf("%d",&n)!=EOF,n){
        memset(a,0,sizeof(a));
        memset(dp,0,sizeof(dp));

        for(int i=0;i<n;i++){
            scanf("%d",&a[i]);
        }
        int maxV=a[0];
        dp[0]=a[0];
        for(int i=1;i<n;i++){
           int sum=a[i];
           for(int j=0;j<i;j++){
                if(a[i]>a[j])sum=max(sum,dp[j]+a[i]);
                //如果前边的值a[j]小于a[i],就可找j处的最大值dp[j]+a[i],一直找到dp[i]的最大值,更新就行
           }
           dp[i]=sum;
           maxV=max(maxV,dp[i]);//找1---n中dp值最大的一个
        }
        printf("%d\n",maxV);
    }
return 0;
}

传统蓝牙、BLE与蓝牙Mesh深度对比:核心技术区别、应用场景及选型指南 以下是 传统蓝牙(Classic Bluetooth)、BLE(蓝牙低功耗)和蓝牙Mesh 的核心区别、技术特点及应用场景的对比分析 阅读详情

相关推荐

LVGL在STM32H743IIT6上的性能优化技巧:如何提升图形界面刷新速度

本文详细介绍了在STM32H743IIT6高性能MCU上优化LVGL图形界面刷新速度的实战技巧。通过利用芯片的DMA2D硬件加速模块替代低效的软件画点,将绘制缓冲区放入SDRAM并启用双缓冲机制,以及合理配置CPU缓存与MPU,有效解决了界面卡顿问题。文章还涵盖了LVGL引擎调优、内存架构优化等关键步骤,帮助开发者充分发挥STM32H743的硬件潜力,实现流畅的图形界面体验。

vscode6remote的博客 313

HDU1087(初识数位dp)

题目链接HDU1087 这道题难在他的思想上,作为入门数位dp的一道基础题并没什么难度,我借此机会写下自己对这题的理解。 动态规划最重要的是掌握他的思想,动态规划的核心思想是把原问题分解成子问题进行求解,也就是分治的思想。 解题思路: 创建数组 a 和数组dp,下标从 1 开始,dp[ i ]表示的是以下标为 i 的元素作为一小段数组的结尾的这段数组的最大值。 比如:dp[ 5 ] = { 1 , 3 , 4 , 2 , 5 } ,dp[ 2 ] 代表以 3 结尾的{1 , 3 }这样一段数组的最大值,因此

HXZ_CREATE的博客 422

GoPro官方API实战:从蓝牙配对到Wi-Fi流媒体,构建跨平台控制应用

本文详细解析了GoPro官方API的开发实践,涵盖蓝牙配对、Wi-Fi流媒体控制等关键技术。通过实战案例,指导开发者如何构建跨平台控制应用,解决设备发现、指令解析、视频流传输等核心问题,并分享Android平台迁移经验与常见问题排查方法。

weixin_30727835的博客 404

HDU-1087(最长上升子序列和)

题意:给你一序列,找出一个和最大的上升子序列, 输出它的和。 思路:动态规划,建立dp数组。因为这题要求是上升子序列,我们需要知道当前子序列末尾的值,所以可使dp[i]表示以i结尾的序列的最大和。这样循环到a[i]时,可通过找到dp数组前i-1项的最大值dp[j],并比较a[j](当前序列最后一项)与当前a[i]的大小。如果a[i] &gt; a[j],则a[i]可加到当前序列。若没找到,则以a...

ImwImW的博客 974

AI辅助需求分析与提示词生成

文章标题 《AI辅助需求分析与提示词生成》 关键词 人工智能 需求分析 提示词生成 深度学习 机器学习 强化学习 数学模型 系统架构

AI天才研究院 1226

Python爬虫实战:利用Playwright和反反爬技术高效抓取Bloomberg金融数据

用户行为分析(鼠标移动、点击模式)请求头检测IP频率限制WebSocket通信验证Canvas指纹识别我们的爬虫需要模拟人类行为,使用代理IP池,并合理控制请求频率。

2201_76125261的博客 1024

hdu1087(dp:解决寻找最大序列值问题。dp[n] = max{dp[n],dp[k] + a[n]}【当a[n]>a[k]时执行】)

题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1087 题目大意: 就是给你一个数字序列,让你寻找一个从小到大排序的子序列是所有这样排序的子序列最大值。比如:下图所示中的,前面的第一个数代表着后面有几个数字。故第一例的数字序列就只是:1 3 2.所以其最大的子序列的值为4,这个子序列为:1 3; 故第二例:1 2 3 4,其最大子序列的值为10,子...

zhoupingqi2017的博客 346

【深度学习驱动流体力学】OpenFOAM目录流体力学求解器汇总介绍

下面这些目录结构和其中的求解器和工具展示了OpenFOAM作为一个功能强大且广泛应用的开源CFD软件框架的多样性和灵活性。每个求解器都专门用于解决不同类型的流体动力学问题,从基础的流动模拟到复杂的多相流动和燃烧模拟等各种应用场景。

源代码杀手的博客 1194

hdu——1087——Super Jumping! Jumping! Jumping!

地址:http://acm.hdu.edu.cn/showproblem.php?pid=1087 求出最长上升子序列的和 #include #include #include using namespace std; int a[1010],dp[1010]; int main() { int i,j,n,m,k; while(scanf("%d",&

Kamy Shi 856

视觉Transformer实战 | Data-efficient image Transformer(DeiT)详解与实现

在计算机视觉领域,Vision Transformer (ViT) 已经证明了纯 Transformer 架构在图像分类任务上的强大能力。然而,ViT 通常需要在大规模数据集上预训练才能达到最佳性能,DeiT (Data-efficient image Transformer) 通过引入一系列训练策略和优化,使得 Transformer 模型能够在相对较小的数据集上取得优异表现。本节将详细介绍 DeiT 的技术原理,并使用 PyTorch 从零开始实现 DeiT 模型。

盼小辉丶的博客 1352

苹果生态最佳搭档:Mac mini + OpenClaw + iPhone 远程控制

本文详细介绍如何通过iPhone远程控制Mac mini上的OpenClaw应用,打造高效苹果生态工作流。内容包括:1) 苹果生态整合优势,包括AirDrop、Handoff等功能对比;2) Mac mini配置步骤,涵盖SSH/VNC设置、网络优化及Docker部署OpenClaw;3) iPhone端SSH/VNC客户端选择与Tailscale内网穿透配置;4) 详细SSH密钥设置与连接测试方法。通过这套方案,用户可实现跨设备无缝控制OpenClaw应用,提升远程工作效率。(149字)

一键难忘的博客 800

HDU1087 - Super Jumping! Jumping! Jumping! (Java)

HDU1087 - Super Jumping! Jumping! Jumping! (Java)

Mosyi_的博客 238

CD-SSB和NCD-SSB相关内容

NR中,PSS/SSS 和PBCH总是绑定的,因此也称为SSB block。频域由下往上,第121个SC(k = 120)的中心频率,就是SSB的GSCN对应的SSREF(同步参考频率)的出处如上,同步栅格映射到SSB 的RE位置是10个PRB的位置,然后指向RE index 0,即第121个子载波的中心频率;UE获得N_offset_GSCN后,即可结合当前SSB的GSCN推算下一个SSB的GSCN =N_Reference_GSCN(当前SSB的GSCN) + N_offset_GSCN。

asd199086的博客 3450

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

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

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

迈瑞BS系列全自动生化分析仪LIS协议接口手册(内含HL7和ASTM)

迈瑞BS系列全自动生化分析仪LIS协议接口手册,内含HL7和ASTM)

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.

旺崽的博客 2689

霍尼韦尔SoftMaster使用说明

霍尼韦尔SoftMaster使用说明

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

老版QQ原生表情gif动态

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

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 838

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

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 171

杭电 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

邓汪涛的博客 256

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

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! 最大上升子序列。模板题

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 2069

hdu1087Super Jumping! Jumping! Jumping!(最大递增序列和)

题意:棋牌游戏如今,一种被称为“超级跳!跳!跳!“HDU是非常流行的。也许你是个好孩子,这个游戏知之甚少,所以我介绍给你吧。 可以玩游戏由两个或两个以上的球员 ​​。它由一个棋盘(棋盘)和一些棋子(棋子),所有的棋子标记的正整数或“开始”或“结束”。玩家从起始点和终点终于跳进。在跳跃的过程中,玩家将访问路径中的棋子,但每个人都必须从一个棋子跳跃到另一个绝对更大(可以假定启动点

陌上花开 1143
上一篇: hdu5015 233 Matrix(构造矩阵)
下一篇: hdu1559 最大子矩阵(DP)
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值