View Code
#include"iostream"
using namespace std;
int main()
{
int t;
int n,a;
int i,j=0,k;
cin>>t;
while(t--)
{
cin>>n;
int sum=0,Max=-99999999;
int start=0,end=0;
k=0;
for(i=0;i<n;i++)
{
cin>>a;
sum+=a;
if(sum>Max)
{
Max=sum;
start=k+1;
end=i+1;
}
if(sum<0)
{
sum=0;
k=i+1;
}
}
cout<<"Case "<<++j<<":"<<endl;
cout<<Max<<" "<<start<<" "<<end<<endl;
if(t>0) cout<<endl;
}
return 0;
}