Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //
- // This program is free software; you can redistribute it and/or modify
- // it under the terms of the GNU General Public License as published by
- // the Free Software Foundation; either version 2 of the License, or
- // (at your option) any later version.
- //
- // This program is distributed in the hope that it will be useful,
- // but WITHOUT ANY WARRANTY; without even the implied warranty of
- // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- // GNU General Public License for more details.
- //
- // You should have received a copy of the GNU General Public License
- // along with this program; if not, write to the Free Software
- // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- // MA 02110-1301, USA.
- #include <stdio.h>
- #include <math.h>
- #include <string.h>
- int main()
- {
- long long int t, i, j, k, l, a, b, c, d, x, y, z, flag, count, max, min, n;
- long long int ar[100000];
- char ch, str[10];
- for (i = 1; ;i++)
- {
- if (scanf("%lld", &n) == EOF)
- break;
- max = 0, min = 0;
- for (j = 0; j < n; j++)
- {
- scanf("%lld", &ar[j]);
- }
- scanf("%c", &ch);
- scanf("%c", &ch);
- for (k = 0; k <= n - 1; k++)
- {
- z = 1;
- for (l = k; l <= n - 1; l++)
- {
- z = z * ar[l];
- if (z >= max)
- {
- max = z;
- }
- }
- }
- printf("Case #%lld: The maximum product is %lld.\n\n", i, max);
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement