直接硬爆解即可得解。
C++(0.024)
/*******************************************************/
/* UVa 11059 Maximum Product */
/* Author: Maplewing [at] knightzone.studio */
/* Version: 2012/09/15 */
/*******************************************************/
#include<iostream>
#include<cstdio>
using namespace std;
int main(){
int N, casenum = 1;
long long S[20], maxproduct, temp;
while( scanf( "%d", &N ) != EOF ){
for( int i = 0; i < N ; i++ )
scanf( "%lld", &S[i] );
maxproduct = 0;
for( int i = 0 ; i < N ; i++ ){
temp = 1;
for( int j = i ; j < N ; j++ ){
temp *= S[j];
if( temp > maxproduct ) maxproduct = temp;
}
}
printf( "Case #%d: The maximum product is %lld.\n\n", casenum++, maxproduct );
}
return 0;
}