标签:
int max_sum(int *arr,int len) { assert(arr); assert(len > 0); int sum=0; int key=-INT_MAX; for(int i=0; i<len; ++i) { if(sum <= 0) sum=arr[i]; else sum+=arr[i]; if(sum >= key) key=sum; } return key; }
标签:
原文地址:http://blog.csdn.net/zhou753099943/article/details/52204018