#define LL long long
#define SZ(x) ((int)(x).size())
#define ALL(x) (x).begin(),(x).end()
#define REP(i,n) for(int i=0;i<n;i++)
#define REV(i,n) for(int i=n-1;i>=0;i--)
#define FOR(i,a,b) for(int i=a;i<=b;i++)
#define pri(a) cout<<a<<endl
#define prii(a,b) cout<<a<<" "<<b<<endl
#define hi printf("Hello World\n");
using namespace std;
const int INF = 1<<29;
const int MX = 1e5+10;
/// ** product of -ve numbers results in +ve/-ve both
int main()
{
LL prod,n,a[MX],mx=0,cs=0;
while(cin>>n and n)
{
mx = 0;
REP(i,n) cin>>a[i];
REP(i,n)
{
prod=1;
for(int j=i; j<n and prod; j++)
{
prod*=a[j];
mx=max(mx,prod);
}
}
printf("Case #%lld: The maximum product is %lld.\n\n", ++cs, mx);
}
return 0;
}
No comments:
Post a Comment