摘要: #include <iostream>#include <vector>#include <algorithm>using namespace std;double func(double *a,const int n){ double dp[2]={0},maxv = a[0]; dp[0] = a[0]; for(int i = 1; i < n; i ++ ){ dp[i%2] = max(a[i],dp[(i-1)%2]*a[i]); maxv=max(maxv,dp[i%2]); } return maxv;}int main... 阅读全文
posted @ 2013-04-30 19:39 OpenSoucre 阅读(187) 评论(0) 推荐(0) 编辑
摘要: #include <iostream>#include <vector>#include <algorithm>using namespace std;int MaxSum(int *a, int n){ int maxv = -1<<30,value = 0; for(int i = 0 ; i < n ; i ++ ){ value += a[i]; maxv=max(maxv,value); value=max(0,value); } return maxv;}int main(){ int a[8]={-2,-2... 阅读全文
posted @ 2013-04-30 19:17 OpenSoucre 阅读(170) 评论(0) 推荐(0) 编辑