最大字段和
#include <iostream>
#include <algorithm>
#include <string.h>
using namespace std;
typedef long long ll;
const long long Len=100005;
int p[Len];
int main(){
int t;
cin>>t;
int casee=0;
while(t--){
int n;
cin>>n;
for(int i=0;i<n;i++)cin>>p[i];
int i=0,s,e,k;
s=e=k=0;
long long ans=-0xffffff;
ll tmp=0;
for(;i<n;i++){
tmp+=p[i];
if(tmp>=ans){
s=k;
e=i;
ans=tmp;
}
if(tmp<0){
k=i+1;
tmp=0;
}
}
if(n==0)ans=0;
cout<<"Case "<<++casee<<':'<<endl;
cout<<ans<<' '<<s+1<<' '<<e+1<<endl;
if(t!=0)
cout<<endl;
}
}