Пример #1
0
int main()
{
	int arr[] = {1,-2,-3,0,7,-8,-2}
	int n = sizeof(arr)/sizeof(arr[0]);
	maxSubProduct(arr,n);
	return 0;
}
int maxSubarrayProduct(int *a, int n){
	int start = -1;
	int m = -1;
	int i=0;
	while(a[i]==0){
		start = i;
		i++;
	}
	start++;
	for(; i<n; i++){
		if(a[i]==0){
			m = max(m, maxSubProduct(a, start, i-1));
			start = i+1;
		}
	}
	//cout<<"@"<<start<<" "<<i<<" "<<maxSubProduct(a, start, i-1);
	m = max(m, maxSubProduct(a, start, i-1));
	return m;
}