(http://acm.split.hdu.edu.cn/showproblem.php?pid=1003)
#include <iostream>
using namespace std;
int main()
{
int j,i,k,n,m,t;
int a; //不需要数组,只需要一个输入变量
scanf("%d",&t);
for (j=1;j<=t;j++)
{
scanf("%d",&n);
int sum=0,maxsum=-1001,first =0, last = 0, temp = 1;
for (i=0;i<n;i++)
{
scanf("%d",&a);
sum += a;
if (sum > maxsum)
maxsum = sum;first = temp;last = i+1;
if (sum < 0)
sum = 0;temp = i+2;
}
//注意格式,我就因为将冒号写到了数的前边而wrong answer,郁闷半天才发现……
printf("Case %d:\n%d %d %d\n",j,maxsum,first,last);
if (j!=t)
printf("\n");
}
return 0;
}