杭电ACE 1003题,Wrong Answer ,请大侠修改,谢谢

2024-11-30 05:41:36
推荐回答(1个)
回答1:

#include
int main()
{
int i,j,m,n,a[100000];
int x,y;
int maxsum,sum,l0,l1;
scanf("%d",&n);
for(i=0;i {
scanf("%d",&m);
for(j=0;j scanf("%d",&a[j]);
maxsum=a[0];
y=l0=l1=1;
sum=a[0];
for(x=1;x {
if(sum>=0)
sum+=a[x];
else
{
y=x+1;
sum=a[x];
}
if(sum>maxsum)
{
maxsum=sum;
l0=y;
l1=x+1;
}
}
printf("Case %d:\n%d %d %d\n",i+1,maxsum,l0,l1);
if(i printf("\n");
}
return 0;
}