[ACM] POJ 2479 Maximum sum (动态规划求不相交的两段子段和的最大值)
来源:互联网 发布:网络能上网不能玩游戏 编辑:程序博客网 时间:2024/06/04 18:07
Maximum sum
Time Limit: 1000MS Memory Limit: 65536KTotal Submissions: 33363 Accepted: 10330
Description
Given a set of n integers: A={a1, a2,..., an}, we define a function d(A) as below:Your task is to calculate d(A).
Input
The input consists of T(<=30) test cases. The number of test cases (T) is given in the first line of the input.
Each test case contains two lines. The first line is an integer n(2<=n<=50000). The second line contains n integers: a1, a2, ..., an. (|ai| <= 10000).There is an empty line after each case.
Each test case contains two lines. The first line is an integer n(2<=n<=50000). The second line contains n integers: a1, a2, ..., an. (|ai| <= 10000).There is an empty line after each case.
Output
Print exactly one line for each test case. The line should contain the integer d(A).
Sample Input
1101 -1 2 2 3 -3 4 -4 5 -5
Sample Output
13
Hint
In the sample, we choose {2,2,3,-3,4} and {5}, then we can get the answer.
Huge input,scanf is recommended.
Huge input,scanf is recommended.
Source
POJ Contest,Author:Mathematica@ZSU
0 0
- [ACM] POJ 2479 Maximum sum (动态规划求不相交的两段子段和的最大值)
- [ACM] POJ 2479 Maximum sum (动态规划求不相交的两段子段和的最大值)
- POJ 2479 Maximum sum (求2个不相交的连续字段和的最大值)
- poj 2479 求两段子数组和相加的最大值
- POJ 2479 Maximum sum(dp—求最大的两个不相交的字段和)
- poj2479 Maximum sum 求最大的 数列中不相交的俩个子段和
- 1486【动态规划★★】Max Sum Plus Plus.(求n个数m个不相交子段的最大和)
- POJ 2479 动态规划 最大子序列问题(两段) Maximum sum
- hdu 1024 Max Sum Plus Plus(dp求m个不相交子段和的最大值)
- 经典动态规划——HDU1024 m段子段和的最大值
- hdu 1024 Max Sum Plus Plus (求一个序列中选出的m个不相交子段和的最大值)
- poj 2479 Maximum sum(求最大子段和的延伸)
- poj 2479 Maximum sum(求最大子段和的延伸)
- 【动态规划】poj2479 Maximum sum && poj2593 Max Sequence(求两段不相交字串的最大和)
- poj 2479 Maximum sum 两段不相交最大子段和
- hdu 1024 Max Sum Plus Plus(动态规划+m子段和的最大值)
- A - Max Sum Plus Plus HDU1024 ( 动态规划 多段连续子段和的最大值)
- poj 2479 dp Maximum sum求两段连续不重叠子段的最大和
- php获取网页源代码
- poj 3253 Fence Repair(哈夫曼树)
- Notch:一个程序员如何达到身价1.1亿美元?
- 《程序员面试宝典》精华 编程语言部分
- struts的<package name="login" namespace="/system" extends="struts-default">是什么意思?
- [ACM] POJ 2479 Maximum sum (动态规划求不相交的两段子段和的最大值)
- UVA1267 - Network
- 栈实现括号匹配
- 成为优秀程序员的十个有效方法
- Hello World
- C++ inline
- 记住这句话...SOAP
- AWK 简明教程
- 解读卓越程序员密码(2)