Advertisement
palmerstone

Untitled

Jun 5th, 2011
507
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.62 KB | None | 0 0
  1. //
  2. // This program is free software; you can redistribute it and/or modify
  3. // it under the terms of the GNU General Public License as published by
  4. // the Free Software Foundation; either version 2 of the License, or
  5. // (at your option) any later version.
  6. //
  7. // This program is distributed in the hope that it will be useful,
  8. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. // GNU General Public License for more details.
  11. //
  12. // You should have received a copy of the GNU General Public License
  13. // along with this program; if not, write to the Free Software
  14. // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
  15. // MA 02110-1301, USA.
  16.  
  17. #include <stdio.h>
  18. #include <math.h>
  19. #include <string.h>
  20.  
  21. int main()
  22. {
  23. long long int t, i, j, k, l, a, b, c, d, x, y, z, flag, count, max, min, n;
  24. long long int ar[100000];
  25. char ch, str[10];
  26.  
  27. for (i = 1; ;i++)
  28. {
  29. if (scanf("%lld", &n) == EOF)
  30. break;
  31. max = 0, min = 0;
  32. for (j = 0; j < n; j++)
  33. {
  34. scanf("%lld", &ar[j]);
  35. }
  36. scanf("%c", &ch);
  37. scanf("%c", &ch);
  38.  
  39. for (k = 0; k <= n - 1; k++)
  40. {
  41. z = 1;
  42. for (l = k; l <= n - 1; l++)
  43. {
  44. z = z * ar[l];
  45. if (z >= max)
  46. {
  47. max = z;
  48. }
  49. }
  50. }
  51. printf("Case #%lld: The maximum product is %lld.\n\n", i, max);
  52. }
  53. return 0;
  54. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement