标签:
#include"stdio.h" int main(){ int nn; scanf("%d",&nn); for(int n=1;n<=nn;n++){ int num; scanf("%d",&num); int begin=0,end=0,max=-100000,temp=0,next,begin_temp=1; for(int i=1;i<=num;i++){ scanf("%d",&next); temp+=next; if(temp>max){ max=temp; end=i; begin=begin_temp; } if(temp<0){ temp=0; begin_temp=i+1; } } printf("Case %d:\n%d %d %d\n",n,max,begin,end); if(n!=nn)printf("\n"); } }
标签:
原文地址:http://www.cnblogs.com/lyqatdl/p/4713125.html