码迷,mamicode.com
首页 >  
搜索关键字:连续子序列和    ( 85个结果
A 最大连续子序列和
A 最大连续子序列和 问题描述: 思路:只要从1到n扫一遍,不断累加,出现负值就置为0,不断维护最大值即可。 注意:序列全为负数的情况和a,b的选取。 掌握:一般看到题目的数据范围,就可以排除掉一些复杂度明显爆炸的做法。 代码: #include<stdio.h> int main() { int ...
分类:其他好文   时间:2016-03-31 14:33:34    阅读次数:191
HDU 1087 Super Jumping! Jumping! Jumping
HDU 1087 题目大意:给定一个序列,只能走比当前位置大的位置,不可回头,求能得到的和的最大值。(其实就是求最大上升(可不连续)子序列和) 解题思路:可以定义状态dp[i]表示以a[i]为结尾的上升子序列的和的最大值,那么便可以得到状态转移方程 dp[i] = max(dp[i], dp[j]+
分类:其他好文   时间:2016-03-07 01:22:42    阅读次数:164
URAL1146 & POJ1050 Maximum Sum (最大连续子序列和)
DescriptionGiven a 2-dimensional array of positive and negative integers, find the sub-rectangle with the largest sum. The sum of a rectangle is the s...
分类:其他好文   时间:2015-11-18 10:36:20    阅读次数:151
POJ2479(最长连续子序列和)
Maximum sumTime Limit:1000MSMemory Limit:65536KTotal Submissions:37035Accepted:11551DescriptionGiven a set of n integers: A={a1, a2,..., an}, we defin...
分类:其他好文   时间:2015-11-13 14:32:19    阅读次数:171
任意区间的最长连续递增子序列,最大连续子序列和
hdu3308给n个数,有m个操作U a b 表示将第a个数改成bQ a b 表示询问区间[a,b]的最长连续递增子序列。区间询问问题且带修改,一般是用线段树来解决那么要维护Llen[rt], Lval[rt][2] 表示rt所对应的区间[l,r] 以l开头的最长连续递增子序列的长度, Lval[r...
分类:其他好文   时间:2015-10-02 18:43:28    阅读次数:187
HDU1231 最大连续子序列和
Problem Description 给定K个整数的序列{ N1, N2, ..., NK },其任意连续子序列可表示为{ Ni, Ni+1, ...,  Nj },其中 1 例如给定序列{ -2, 11, -4, 13, -5, -2 },其最大连续子序列为{ 11, -4, 13 },最大和  为20。  在今年的数据结构考卷中,要求编写程序得到最大和,现在增加一个要求,即还...
分类:其他好文   时间:2015-08-20 13:16:29    阅读次数:125
HDU 1003.Max Sum【最大连续子序列和】【8月14】
Max Sum Problem Description Given a sequence a[1],a[2],a[3]......a[n], your job is to calculate the max sum of a sub-sequence. For example, given (6,-1,5,4,-7), the max sum in this sequence is...
分类:其他好文   时间:2015-08-14 19:06:00    阅读次数:118
最大子序列和 HDOJ 1003 Max Sum
题目传送门 1 /* 2 题意:求最大连续子序列和及两个端点 3 累积遍历算法 O(n):依照sum14 #include 15 #include 16 #include 17 #include 18 #include 19 #include 20 #include 21 #incl...
分类:其他好文   时间:2015-08-10 19:58:08    阅读次数:109
最大连续子序列的和
求给定序列的最大连续子序列和。输入:第一行:n(ny then exit(x) else exit(y);end;begin readln(n); fillchar(f,sizeof(f),0); for i:=1 to n do read(a[i]); f[1]:=a[1]; for i...
分类:其他好文   时间:2015-08-07 00:04:35    阅读次数:96
HDU3415
题意:给一串数,求解最大连续子序列和。 思路:和HDU1003一样,增加了两个条件,所取的区间长度必须在K范围内,另外这是一个循环数组,所以考虑可以用单调队列来做,另外可以直接循环数组操作,和1003差不多。 #include #include #include #define N 200050 using namespace std; int S[N],q[N]; int MA...
分类:其他好文   时间:2015-08-02 16:55:32    阅读次数:123
85条   上一页 1 ... 3 4 5 6 7 ... 9 下一页
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!