#include<stdio.h>
int MinSubsequenceSum(const int A[],int n)
{
int i,sum,MinSum;
sum=MinSum=0;
for(i=0;i<n;i++)
{
sum+=A[i];
if(sum<MinSum)
MinSum=sum;
if(sum>0)
sum=0;
}
return MinSum;
}
void main()
{
int arr[10]={3,4,-2,5,-4,6,-2,8,-9,-23};
int min=MinSubsequenceSum(arr,10);
printf("%d\n",min);
}
原文地址:http://www.cnblogs.com/wuchanming/p/3790875.html