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

 

题意:

有n个数字,下一个要选择的数字必须大于前面一个选择的数字,问能等到的最大数字和是多大?

 

思路:

求最大递增子串和,利用动态规划的思想;

 

代码:

#include<stdio.h>
int main()
{
    int n;
    while(~scanf("%d",&n)&&n)
    {
        int a[1100],dp[1100]= {0},maxx=-1;
        for(int i=1; i<=n; i++)
            scanf("%d",&a[i]);
        for(int i=1; i<=n; i++)
        {
            int sum=0;
            for(int j=1; j<i; j++)
            {
                if(a[j]<a[i])
                    if(dp[j]>sum)
                        sum=dp[j];
            }
            dp[i]=a[i]+sum;
            if(dp[i]>maxx)
                maxx=dp[i];
        }
        printf("%d\n",maxx);
    }
    return 0;
}

 

手把手教你解决Windows 10网络驱动器无法访问问题(附详细排查步骤) 本文详细指导Windows 10用户解决网络驱动器无法访问的常见问题。通过从现象快速定位到系统排查,提供了从检查网络连通性、修复凭据权限到调整高级设置的完整步骤,特别是针对“找不到网络路径”等错误,帮助用户高效恢复对共享资源的访问。 阅读详情

相关推荐

迪文串口屏开发环境搭建全流程:从DGUS Tool到串口联调

串口屏作为嵌入式人机交互的核心组件,通过串口通信实现主控MCU与显示终端的指令交互。其工作原理基于变量地址映射,主控读写VP地址即可驱动屏上控件,兼具低功耗与高稳定性。在工业控制、医疗设备及智能家居面板等场景中,串口屏能显著降低开发门槛与硬件成本。迪文屏凭借DGUS Tool上位机与自定义串口协议,成为主流选择。掌握DGUS Tool版本匹配、串口驱动安装及VP地址规划,是快速搭建开发环境的关键。

weixin_33937499的博客 602

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

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

【智慧城市】GIS数据获取-获取道路/水路数据

【GIS数据获取】获取道路/水路数据

qq_16599281的博客 4749

AI产品经理面试宝典第94天:RAG知识库构建与预处理策略面试指南

本文深入解析RAG知识库构建的核心挑战与预处理策略,涵盖文档格式转换、问答对生成及自动化测试全流程,为AI产品经理提供面试必备的实战方法论与避坑指南,助你精准应对技术深度类问题。

打造全国最全的AI Agent开发知识领域的博客 311

Super Jumping! Jumping! Jumping!(DP 最长不下降子序列 )超详细题解

目录1.题目2.题意3.解题思路4.代码 1.题目 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 ...

林深不见鹿 的博客 1358

ASPICE标准快速掌握「总目录」

欢迎大家来到雪云飞星的《ASPICE标准快速掌握》,开始前博主先列出本专栏学习的大纲,同时这也可以作为大家学习ASPICE协议知识点的参考。本专栏可以帮助大家快速掌握如何在项目中使用ASPICE,ASPICE的学习通常仅需要半天时间左右,掌握方法后完全就可以结合快查表来指导具体项目的质量提升了。

雪云飞星的博客 3008

Super Jumping! Jumping! Jumping!【暑期培训E题】【经典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 introdu...

既然弱小,就只顾变强就是了 330

AI自动化时代:一人公司的崛起与商业机会

AI技术正在重塑商业格局,催生"一人公司"创业新模式。这种轻资产、高效率的商业模式通过AI自动化运营,让个人创业者能以极低成本挑战传统企业。核心机会包括:1)AI自主公司替代人力密集型业务;2)为企业提供AI转型解决方案;3)利用AI工具实现个人创业。创业者需快速验证创意,聚焦人机协作,把握当前AI发展窗口期。未来,AI赋能的"一人公司"将成为商业新常态,带来更高的专业化和灵活性。抓住AI红利,学会人机协作,是个人创业成功的关键。

这里汇聚了前沿的技术分享与实用的开发技巧,带你探索从创意到企业的技术创业之路。 518

Android Framework AudioFlinge 面试题及参考答案

请解释什么是 AudioFlinger? AudioFlinger 是 Android 音频系统中的一个关键服务。它位于 Android 系统的中间层,是连接上层应用和底层音频硬件驱动的重要桥梁。从功能角度来讲,它主要负责音频数据的混合(Mix)以及输出(Output)。 当多个应用程序同时播放音频时,比如一个音乐播放器在播放歌曲,同时手机的闹铃响起,AudioFlinger 就会发挥它的混合功能。它会把这些不同来源的音频数据按照一定的规则和算法混合在一起。这种混合并不是简单的相加,而是要考

大模型大数据攻城狮的专栏 1574

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

薄荷糖 1422

GEE:随机森林分类教程(样本制作、特征添加、训练、精度、参数优化、贡献度、统计面积)

本文将介绍在Google Earth Engine (GEE)平台上进行随机森林分类的方法和代码,其中包括制作样本点教程(本地、在线和本地在线混合制作样本点,合并样本点等),加入特征变量,运行随机森林分类器教程,计算随机森林分类结果的精度,优化随机森林分类算法的参数,打印各个变量特征的贡献度等步骤的方法和代码。本教程可以应用于多种分类场景,包括土地利用分类、种植区提取(大蒜、小麦、玉米等)、局部气候区分类、植被分类等多种场景。

养乐多的博客 1万+

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

假人有限元模型

假人模型,车辆碰撞假人有限元模型,适合做乘员安全的研究者利用

visio安装包

Microsoft Office Visio 是一款专业的制图软件。利用经过更新的形状、协作工具和数据链接图表,创建专业级图表以简化复杂的信息。

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

Camera2Demo

在Camera2 的基础上进行封装,使得Camera2一堆初始化逻辑与Activity分离,降低耦合度,完成预览拍照并保存的操作

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

怀旧版电脑GBC模拟器

再现原版GBC掌机的界面,电脑运行连游戏界面都一样大小,很怀旧,很真实,(英文版)强烈推荐,很小的文件,很难才找到的。

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

GJLfly的博客 280

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

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

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!

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

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
上一篇: Robot Rapping Results Report
下一篇: 二叉搜索树
admin__
博客等级 码龄8年 3粉丝 79原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值