标签:
连续子数组的最大和:
int findGreatSum(int*data,int len)
{
if(!data||len<0)
return;
int sum=0;
int maxsum=0;
int start=0;
int end=0;
for(int i=0;i<len;i++)
{
if(i=0||sum<=0)
sum=data[i];
start=i;
else
sum+=data[i];
if(sum>maxsum)
{
maxsum=sum;
end=i;
}
return maxsum;
}
}
标签:
原文地址:http://www.cnblogs.com/mmziscoming/p/5814824.html