简单维护前导和
#include<stdio.h>
int main()
{
int sum,a[],cas,key=;
scanf("%d",&cas);
while(cas--){
int n,i,max_sum,max_index,min_index,keyl;
scanf("%d%d",&n,&a[]);
max_sum=sum=a[];
keyl=;
max_index=min_index=;
if(sum<){sum=;keyl=;}
for(i=;i<n;i++){
scanf("%d",&a[i]);
sum+=a[i];
if(sum>max_sum){
max_sum=sum;
max_index=i+;
min_index=keyl+;
}
if(sum<){
sum=;
keyl=i+;
}
}
printf("Case %d:\n",key++);
printf("%d %d %d\n",max_sum,min_index,max_index);
if(cas)printf("\n");
}
return ;
}