HDU_1087_Super Jumping! Jumping! Jumping!_dp
内容导读
互联网集市收集整理的这篇技术教程文章主要介绍了HDU_1087_Super Jumping! Jumping! Jumping!_dp,小编现在分享给大家,供广大互联网技能从业者学习和参考。文章包含2361字,纯文字阅读大概需要4分钟。
内容图文
![HDU_1087_Super Jumping! Jumping! Jumping!_dp](/upload/InfoBanner/zyjiaocheng/1103/b0dd69916cf740f89f110007af789648.jpg)
Super Jumping! Jumping! Jumping!
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 32179 Accepted Submission(s): 14487
![技术分享](/upload/getfiles/default/2022/11/9/20221109014147439.jpg)
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.
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.
![技术分享](/upload/getfiles/default/2022/11/9/20221109014147501.jpg)
![技术分享](http://images.cnblogs.com/OutliningIndicators/ExpandedBlockStart.gif)
#include<iostream> #include<cstdio> #include<algorithm> #include<cstring> usingnamespace std; int num[1005]; int dp[1005]; int main() { int n; while(scanf("%d",&n)!=EOF&&n) { int ans=0; memset(dp,0,sizeof(dp)); for(int i=1; i<=n; i++) scanf("%d",&num[i]); for(int i=1; i<=n; i++) for(int j=0; j<i; j++) {if(num[i]>num[j]) dp[i]=max(dp[i],dp[j]+num[i]); if(ans<dp[i]) ans=dp[i]; } printf("%d\n",ans); } return0; }
原文:http://www.cnblogs.com/jasonlixuetao/p/5500558.html
内容总结
以上是互联网集市为您收集整理的HDU_1087_Super Jumping! Jumping! Jumping!_dp全部内容,希望文章能够帮你解决HDU_1087_Super Jumping! Jumping! Jumping!_dp所遇到的程序开发问题。 如果觉得互联网集市技术教程内容还不错,欢迎将互联网集市网站推荐给程序员好友。
内容备注
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 gblab@vip.qq.com 举报,一经查实,本站将立刻删除。
内容手机端
扫描二维码推送至手机访问。