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 t…
HDU 1087 题目大意:给定一个序列,只能走比当前位置大的位置,不可回头,求能得到的和的最大值.(其实就是求最大上升(可不连续)子序列和) 解题思路:可以定义状态dp[i]表示以a[i]为结尾的上升子序列的和的最大值,那么便可以得到状态转移方程 dp[i] = max(dp[i], dp[j]+a[i]), 其中a[j]<a[i]且j<i; 另外每个dp[i]可以先初始化为a[i] 理解:以a[i]为结尾的上升子序列可以由前面比a[i]小的某个序列加上a[i]来取得,故此有dp[j]+a[…
题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=1087 Super Jumping! Jumping! Jumping! Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 47055    Accepted Submission(s): 21755 Problem Description N…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1087 Super Jumping! Jumping! Jumping! Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 24452    Accepted Submission(s): 10786 Problem Description No…
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 t…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1087 ---------------------------------------------------------------------------------------------------------------------------------------------------------- 欢迎光临天资小屋:http://user.qzone.qq.com/593830943…
Super Jumping! Jumping! Jumping! Time Limit:1000MS     Memory Limit:32768KB     64bit IO Format:%I64d & %I64u Submit Status Practice HDU 1087 Appoint description:  System Crawler  (2017-04-13) Description Nowadays, a kind of chess game called “Super…
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…
Super Jumping! Jumping! Jumping! Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 34052    Accepted Submission(s): 15437 Problem Description Nowadays, a kind of chess game called “Super Jumping!…
Super Jumping! Jumping! Jumping! Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 32564    Accepted Submission(s): 14692 Problem Description Nowadays, a kind of chess game called “Super Jumping!…
C - Super Jumping! Jumping! Jumping! Time Limit:1000MS     Memory Limit:32768KB     64bit IO Format:%I64d & %I64u Description Nowadays, a kind of chess game called “Super Jumping! Jumping! Jumping!” is very popular in HDU. Maybe you are a good boy, a…
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 ca…
Super Jumping! Jumping! Jumping! Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 36986    Accepted Submission(s): 16885 Problem Description Nowadays, a kind of chess game called “Super 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 tw…
解题思路:题目的大意是给出一列数,求这列数里面最长递增数列的和 dp[i]表示到达地点i的最大值,那么是如何达到i的呢,则我们可以考虑没有限制条件时候的跳跃,即可以从第1,2,3,---,i-1个地点跳跃到i, 而题目限定了,跳到的那个点的数要比开始跳的那个点的数大 所以,状态转移方程式为 for(i=1;i<=n;i++)   for(j=0;j<i;j++) if(a[j]>a[i])   dp[i]=max(dp[j]+a[i],dp[i]);//找出到达地点i的最大值 反思:本来…
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 consi…
Super Jumping! Jumping! Jumping!Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 47017    Accepted Submission(s): 21736 Problem DescriptionNowadays, a kind of chess game called “Super Jumping! Ju…
Super Jumping! Jumping! Jumping! Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 59516    Accepted Submission(s): 27708   Problem Description Nowadays, a kind of chess game called “Super 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 now. The game ca…
Super Jumping! Jumping! Jumping! Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 40030    Accepted Submission(s): 18437 Problem Description Nowadays, a kind of chess game called “Super Jumping!…
DP基础题 DP[i]表示以a[i]结尾所能得到的最大值 但是a[n-1]不一定是整个序列能得到的最大值 #include <bits/stdc++.h> using namespace std; ; int dp[maxn],n,a[maxn]; int main() { while(scanf("%d",&n)&&n) { memset(dp,,sizeof(dp)); ;i<n;i++) scanf("%d",&…
题意: 求解最大递增子序列. 例如:3 1 3 2 输入 3  个数 1 3 2 则递增子序列有 {1} {3} {2} {1 3} {1 2} ,故输出子序列的最大和 4 解题思路: x[n](n个数) 数组存储 输入的数据 dp[i] 用来记录 前 i+1 {数据从下标为0开始存储}个数的 最大结果 遍历dp[] 找到最大值即可. 因 G20 网站暂停提交 明天测试代码. 2016.08.27 代码提交成功! 代码如下: #include<bits/stdc++.h> using name…
以下引用自:http://www.cnblogs.com/Lyush/archive/2011/08/31/2161314.html沐阳 该题可以算是一道经典的DP题了,题中数据是这样的.以 3 1 3 2 为例,首先 3 代表有三个数, 后面给出三个数,求该串的一个子串,使得其值一直是递增的,而且要求输出最大的和值.可以论证,该子串一定会是最长上升子串,因为,如果一个串还能够插入一个元素的话,那么这个串就一定不是最大的和了.而这个最长的上升子串还满足是所有同样长度的子串中最优的,和值最大. 具…
来源:点击打开链接 最长上升子序列的考察,是一个简单的DP问题.我们每一次求出从第一个数到当前这个数的最长上升子序列,直至遍历到最后一个数字为止,然后再取dp数组里最大的那个即为整个序列的最长上升子序列.我们用dp[i]来存放序列1-i的最长上升子序列的长度,那么dp[i]=max(1,dp[j])+1,(j∈[1, i-1]); 显然dp[1]=1,我们从i=2开始遍历后面的元素即可. 这个没有优化,效率是O(N^2),可以通过二分进行进一步的优化. #include <iostream>…
题意:给定一个长度为n的序列,让你求一个和最大递增序列. 析:一看,是不是很像LIS啊,这基本就是一样的,只不过改一下而已,d(i)表示前i个数中,最大的和并且是递增的, 如果 d(j) + a[i] > d(i)  d(i) = d(j) + a[i] (这是保证和最大),那么怎么是递增呢?很简单嘛,和LIS一样 再加上a[i] > a[j],这不就OK了. 代码如下: #include <cstdio> #include <iostream> #include &l…
题目链接 DP基础题 求的是上升子序列的最大和 而不是最长上升子序列LIS DP[i]表示以a[i]结尾所能得到的最大值 但是a[n-1]不一定是整个序列能得到的最大值 #include <bits/stdc++.h> using namespace std; ; int dp[maxn],n,a[maxn]; int main() { while(scanf("%d",&n)&&n) { memset(dp,,sizeof(dp)); ;i<…
题意: 给定n个数的序列, 找出最长上升子序列和. 分析: #include<cstdio> #include<iostream> #include<queue> #include<cstring> #include<string> #include<map> #include<vector> #include<algorithm> #include<cmath> #define rep(i,a,b…
传送门:HDU_1087 题意:现在要玩一个跳棋类游戏,有棋盘和棋子.从棋子st开始,跳到棋子en结束.跳动棋子的规则是下一个落脚的棋子的号码必须要大于当前棋子的号码.st的号是所有棋子中最小的,en的号是所有棋子中最大的.最终所得分数是所有经过的棋子的号码的和. 思路:读完题之后知道这是一个最长上升子序列的题目.因为之前刚刚看过牛客网上一节讲解最长上升子序列的视屏,所以一上来就找准了方向,but我只知道怎么求最长上升子序列的长度啊,和怎么求???于是自己想方法开始求和,然后就wa掉了一个上午.…
和之前那个长方体最大高度是换汤不换药的题目.每次找之前最大的一个能接的接上即可.代码如下: #include <stdio.h> #include <algorithm> #include <string.h> using namespace std; const int inf = 0x3f3f3f3f; + ; int a[N]; int dp[N]; int main() { int n; && n) { ;i<=n;i++) scanf(&…
题意:在一组数中选取一个上升子序列,使得这个子序列的和最大. 解:和最长上升子序列dp过程相似,设dp[i]为以第i位为结尾最大和,那么dp[i]等于max(dp[0],dp[1],,,,,dp[i-1])+a[i],显然这个过程可以用某些数据结构优化,比如线段树,树状数组等.由于普通写法也能过题,并且比较简单,所以这里只给出O(n2)写法. #include <algorithm> #include <iostream> #include <cstring> #inc…