#include<iostream>
using namespace std;
int main(){
int start,end,t,k,temp,max,a,n;
cin>>t;
k=t;
while(k--){
max=-9999;
start=0;
end=0;
temp=0;
cin>>n;
for(int i=0,j=0;i<n;i++){
cin>>a;
temp+=a;
if(temp>max){
max=temp;
start=j;
end=i;
}
if(temp<0){
temp=0;
j=i+1;
}
}
cout<<"Case "<<t-k<<":"<<endl;
cout<<max<<" "<<start+1<<" "<<end+1<<endl;
if(k!=0)cout<<endl;
}
return 0;
}
hdu1003
最新推荐文章于 2020-08-14 20:01:24 发布