杭电1003
#include<iostream>
using namespace std;
int main()
{
int t, n, z, i, x, begin, last, temp, _case = 1;
cin>>t;
while(t--)
{
begin = 1, last = 1, temp = 1;
int thissum = 0, maxsum = -1001;
cin>>n;
for(i = 1; i <= n; i++)
{
cin>>x;
thissum += x;
if(thissum > maxsum)
{
maxsum = thissum;
begin = temp;
last = i;
}
if(thissum < 0)
{
thissum = 0;
temp = i+1;
}
}
printf("Case %d:\n%d %d %d\n",_case++,maxsum,begin, last);
if(t)
printf("\n");
}
return 0;
}