知识点:模拟,简单枚举
又是一道比较简单的题
#include <bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
#define mk make_pair
#define sz(x) ((int) (x).size())
#define all(x) (x).begin(), (x).end()
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pa;
int main() {
int n;
int output = 1;
while (cin >> n) {
int a[20];
for (int i = 0; i < n; i++) cin >> a[i];
ll Max = -1;
for (int i = 0; i < n; i++) {
ll cur = 1;
for (int j = i; j < n; j++) {
cur *= a[j];
if (cur > Max) Max = cur;
}
}
if (Max == -1) Max = 0;
cout << "Case #" << output++ << ": " << "The maximum product is " << Max << ".\n\n";
}
return 0;
}