标签:style class blog code color 算法
动态规划的算法:
#include<stdio.h> int MaxSubsequenceSum(const int A[],int n) { int i,sum,MaxSum; sum=MaxSum=0; for(i=0;i<n;i++) { sum+=A[i]; if(sum>MaxSum) MaxSum=sum; if(sum<0) sum=0; } return MaxSum; } void main() { int arr[10]={3,4,-2,5,-4,6,-2,8,-9,-23}; int max=MaxSubsequenceSum(arr,10); printf("%d\n",max); }
标签:style class blog code color 算法
原文地址:http://www.cnblogs.com/wuchanming/p/3790874.html