题目大意:给一个数组,找出数组最大的连续子集乘积
解题思路:枚举全部起点和终点
#include <cstdio>
#include <iostream>
using namespace std;
int main() {
long long int number[100];
int n;
int x = 0;
while(scanf("%d", &n) != EOF) {
x++;
long long int max = 0;
for(int i = 0; i < n; i++) {
cin >> number[i];
}
for(int i = 0; i < n; i++) {
long long int p = 1;
for(int j = i; j < n; j++) {
p = number[j] * p;
if(p > max) {
max = p;
}
}
}
printf("Case #%d: The maximum product is %lld.\n\n", x, max);
}
return 0;
}