标签:
/* 最大连续子序列 */ class Solution { public: int maxSubArray(int A[], int n) { if(!n) return 0; int result = A[0],temp =0 ; for(int i = 0 ; i < n ; i++){ if(temp<0) temp = 0; temp+=A[i]; result = max(result,temp); } return result; } };
标签:
原文地址:http://www.cnblogs.com/llei1573/p/4417770.html