Advertisement
Anik_Akash

11059 - Maximum Product

Mar 17th, 2021
704
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.72 KB | None | 0 0
  1. #include<bits/stdc++.h>
  2. using namespace    std;
  3.  
  4. typedef long long int       ll;
  5. typedef double              dl;
  6. typedef unsigned long long  ul;
  7.  
  8. int main()
  9. {
  10.   // #ifndef ONLINE_JUDGE
  11.   //     clock_t tStart = clock();
  12.   //     freopen("input.txt","r",stdin);
  13.   //     freopen("out.txt","w",stdout);
  14.   // #endif
  15.      int t, cnt=0;
  16.      
  17.      while(cin>>t)
  18.      {
  19.         cnt++;
  20.         int  zero_na=0;
  21.         ll ans=1;
  22.         for(int i=1; i<=t; i++)
  23.         {
  24.           int x;
  25.           cin>>x;
  26.           if(x>0){ans=ans*x; zero_na=1;}
  27.         }
  28.         if(zero_na == 0) ans=0;
  29.         cout<<"Case #"<<cnt<<": The maximum product is "<<ans<<"."<<endl;
  30.         cout<<endl;
  31.      }
  32.     return 0;
  33. }
  34.  
  35.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement