-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathUva11059.cpp
More file actions
46 lines (43 loc) · 961 Bytes
/
Copy pathUva11059.cpp
File metadata and controls
46 lines (43 loc) · 961 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#include <iostream>
#include <string>
#include <cstdio>
#include <cstdlib>
#include <vector>
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
#include <algorithm>
#include <sstream>
#include <set>
#include <string.h>
using namespace std;
int main()
{
int n;
int cas=1;
while(cin>>n){
vector<int> elems;
for(int i=0;i<n;i++){
int input;
cin>>input;
elems.push_back(input);
}
cout<<endl;
int maximum=0;
for(int i=0;i<elems.size();i++){
int p=1;
for(int j=i;j<elems.size() && p;j++){
p*=elems[j];
if(p>maximum)maximum=p;
}
}
if(maximum<=0){
cout<<"Case #"<<cas++<<": The maximum product is 0."<<endl;
}
else{
cout<<"Case #"<<cas++<<": The maximum product is "<<maximum<<"."<<endl;
}
cout<<endl;
}
return 0;
}