11059

#include <iostream>
#include <cstdio>
#include <cstring>

#define ll long long
//-1000000000000000000
using namespace std;

int main()
{
	int n,kase=1;
	int a[20];
	ll max_end_here,max_so_far;

	while(scanf("%d",&n)!=EOF)
	{
		for(int i=0;i<n;i++)
		{
			scanf("%d",&a[i]);
		}
		max_so_far=0;
		for(int i=0;i<n;i++)
		{
			for(int j=i;j<n;j++)
			{
				max_end_here=1;
				for(int k=i;k<=j;k++)
				{
					max_end_here*=a[k];
				}
				if(max_so_far<max_end_here)
					max_so_far = max_end_here;
			}
		}
		printf("Case #%d: The maximum product is %lld.\n\n",kase++,max_so_far);
	}
	return 0;
}

 

Leave a Reply

Your email address will not be published. Required fields are marked *