-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathUVa_11059.cpp
More file actions
48 lines (43 loc) · 928 Bytes
/
UVa_11059.cpp
File metadata and controls
48 lines (43 loc) · 928 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
46
47
48
/*************************************************************************
> File Name: UVa_11059.cpp
> Author: dulun
> Mail: [email protected]
> Created Time: 2016年03月18日 星期五 20时24分10秒
************************************************************************/
#include<iostream>
#include<stdio.h>
#include<cstring>
#include<cstdlib>
#include<algorithm>
#define LL long long
using namespace std;
const int N = 50086;
int a[20];
int cnt = 0;
int n;
void f()
{
LL ans = 0;
for(int i = 1; i <= n; i++)
{
LL sum = 1;
for(int j = i; j <= n; j++)
{
sum *= a[j];
ans = max(ans, sum);
}
}
printf("Case #%d: The maximum product is %lld.\n\n", ++cnt, ans);
}
int main()
{
while(~scanf("%d", &n))
{
for(int i = 1; i <= n; i++)
{
scanf("%d", &a[i]);
}
f();
}
return 0;
}