早教吧作业答案频道 -->其他-->
ACMMAXSUM这个题目是什么意思,我竟然看不懂Givenasequencea[1],a[2],a[3]......a[n],yourjobistocalculatethemaxsumofasub-sequence.Forexample,given(6,-1,5,4,-7),themaxsuminthissequenceis6+(-1)+5+4=14.Inp
题目详情
ACM MAX SUM这个题目是什么意思,我竟然看不懂
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 6 + (-1) + 5 + 4 = 14.
Input
The first line of the input contains an integer T(1<=T<=20) which means the number of test cases. Then T lines follow, each line starts with a number N(1<=N<=100000), then N integers followed(all the integers are between -1000 and 1000).
Output
For each test case, you should output two lines. The first line is "Case #:", # means the number of the test case. The second line contains three integers, the Max Sum in the sequence, the start position of the sub-sequence, the end position of the sub-sequence. If there are more than one result, output the first one. Output a blank line between two cases.
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
Author
Ignatius.L
Recommend
We have carefully selected several similar problems for you: 1176 1087 1069 2084 1058
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 6 + (-1) + 5 + 4 = 14.
Input
The first line of the input contains an integer T(1<=T<=20) which means the number of test cases. Then T lines follow, each line starts with a number N(1<=N<=100000), then N integers followed(all the integers are between -1000 and 1000).
Output
For each test case, you should output two lines. The first line is "Case #:", # means the number of the test case. The second line contains three integers, the Max Sum in the sequence, the start position of the sub-sequence, the end position of the sub-sequence. If there are more than one result, output the first one. Output a blank line between two cases.
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
Author
Ignatius.L
Recommend
We have carefully selected several similar problems for you: 1176 1087 1069 2084 1058
▼优质解答
答案和解析
给定的序列a[1],a[2],a[3]......a[n],你的工作是计算最大和的一个子序列。例如,给定( 6, -1,5,4 ,-7 ) ,在这个序列中的最大总和是6 + (-1) + 5 + 4 = 14 。
输入
输入的第一行包含一个整数T( 1 <= T < = 20 )表示的多个测试案例。那么下面的T行,每行开头的一个数N( 1 <= N < = 100000 ) ,然后跟着N个整数( -1000和1000之间的所有整数)。
输出
对于每个测试的情况下,你应该输出两行。第一行是"Case #:",#表示测试情况的数目。第二行包含三个整数,最大和序列中,子序列的开始位置,结束位置的子序列。如果有一个以上的结果,输出的第一个。两种情况之间输出一个空行。
样本输入
2
5 6 -1 5 4 -7
7 0 6 -1 1 -6 7 -5
样本输出
Case 1:
14 1 4
Case 2:
7 1 6
作者
Ignatius.L
建议
我们为您精心挑选了几个类似的问题:1176 1087 1069 2084 1058
输入
输入的第一行包含一个整数T( 1 <= T < = 20 )表示的多个测试案例。那么下面的T行,每行开头的一个数N( 1 <= N < = 100000 ) ,然后跟着N个整数( -1000和1000之间的所有整数)。
输出
对于每个测试的情况下,你应该输出两行。第一行是"Case #:",#表示测试情况的数目。第二行包含三个整数,最大和序列中,子序列的开始位置,结束位置的子序列。如果有一个以上的结果,输出的第一个。两种情况之间输出一个空行。
样本输入
2
5 6 -1 5 4 -7
7 0 6 -1 1 -6 7 -5
样本输出
Case 1:
14 1 4
Case 2:
7 1 6
作者
Ignatius.L
建议
我们为您精心挑选了几个类似的问题:1176 1087 1069 2084 1058
看了 ACMMAXSUM这个题目是...的网友还看了以下:
化学高手们帮帮我啊?超级急的啊!有A,B,C三种常见固体,投入水中分别产生D,E,F三种气体,他们 2020-06-23 …
用以下英文宇母填在上a,a,a,a,a,a,b,e,e,d,e,e,e,e,e,e,f,g,g用以 2020-06-24 …
数学智力题,谁是小偷有A,B,C,D,E,F,G,H,I9个人他们中有一个是小偷但只有4个人说真话 2020-07-08 …
f(x),g(x),h(x)在[a,b]上连续,(a,b)上可导,求证存在一个e属于(a,b)使得 2020-07-16 …
matlab求解二阶导数方程,四个方程四个未知量>>symst>>E=32;G=10.81;b=2 2020-07-19 …
三元一次方程组a*x+b*y+c*z+d=0,e*x+f*y+g*z+h=0,i*x+j*y+k* 2020-08-03 …
各位帮我解一题九宫图用0到9的数字填进九宫图的A到IABCDEFGHI要求:A+B+C=D+E+F= 2020-11-02 …
绕弯的题,我被绕晕了,求函数有七组数据,ABCDEFG,已知A,B,C,七组数据的关系D+E=B,F 2020-11-11 …
求解多元一次不等式的编程47a-b-c-d-e-f-g>047b-a-c-d-e-f-g>023c- 2020-12-14 …
请告诉我哪里错了,如何纠正,错误提示是什么意思?reala,b,c,d,e,f,g,area,tar 2021-02-15 …