线性时间求解最大子序列和——HDU1003
来源:互联网 发布:大六壬排盘软件 哪个好 编辑:程序博客网 时间:2024/05/02 06:10
Problem Description
Givena sequence a[1],a[2],a[3]......a[n], your job is to calculate the maxsum of a sub-sequence. For example, given (6,-1,5,4,-7), the max sum inthis sequence is 6 + (-1) + 5 + 4 = 14.
Input
Thefirst line of the input contains an integer T(1<=T<=20) whichmeans the number of test cases. Then T lines follow, each line startswith a number N(1<=N<=100000), then N integers followed(all theintegers are between -1000 and 1000).
Output
Foreach test case, you should output two lines. The first line is "Case#:", # means the number of the test case. The second line containsthree integers, the Max Sum in the sequence, the start position of thesub-sequence, the end position of the sub-sequence. If there are morethan one result, output the first one. Output a blank line between twocases.
Sample Input
2
5 6 -1 5 4 -7
7 0 6 -1 1 -6 7 -5
Sample Output
Case 1:
14 1 4
Case 2:
7 1 6
- 线性时间求解最大子序列和——HDU1003
- 求解最大子序列和问题的线性时间算法
- hdu1003最大子序列和
- HDU1003-最大子序列和
- HDU1003 最大子序列和问题
- HDU1003 ---最大子序列和 subsequence
- hdu1003 最大连续子序列和
- HDU1003(最大连续子序列和DP)
- hdu1003 最大子序列的和
- HDU1003最大连续子序列和
- hdu1003求最大和子序列
- hdu1003 Max Sum(最大子序列和) —— dp
- hdu1003最大和序列
- hdu1003求最大子序列
- hdu1003 最大连续子序列
- HDU1003--最大连续子序列
- 求解最大子序列和
- 最大子序列和问题的解(线性时间)
- Bash命令行处理流程详解(zz)
- SQL冗余字段的策略和管理
- Beyond Compare Under Linux now!
- SQLServer存储多语言数据的几种方法
- session过期很快的解决方法
- 线性时间求解最大子序列和——HDU1003
- 痛苦使人奋进
- 20条.net编码习惯
- 在Windows Server 2003下运行Rise Of Nations
- 想想十年后的自己
- Ubuntu挂载nfs文件系统
- 开发人员必备网站
- 设置开机启动小程序
- js 验证身份证号码合法性