Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- int main()
- {
- long long t,n,i,j,a[50],ans,max;
- t=1;
- while(scanf("%lld",&n)!=EOF)
- {
- max=0;
- for(i=1;i<=n;i++)
- scanf("%lld",&a[i]);
- for(i=1;i<=n;i++)
- {
- ans=1;
- for(j=i;j<=n;j++)
- {
- ans=ans*a[j];
- if(max<ans)
- max=ans;
- }
- }
- printf("Case #%lld: The maximum product is %lld.\n\n",t++,max);
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement