SHARE
TWEET

Smartphone

a guest Nov 10th, 2015 162 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <iostream>
  2. using namespace std;
  3. #include <algorithm>
  4.  
  5. int main()
  6. {
  7.  
  8.     long long int n, i;
  9.     cin >> n;
  10.     long long int li[n], sale;
  11.    
  12.     for (i = 0; i < n; ++i)
  13.         cin >> li[i];
  14.        
  15.     sort(li, li + n);
  16.     sale = li[n - 1];
  17.    
  18.     for (i = n - 2; i >= 0; --i)
  19.     {
  20.         if (li[i] * (n - i) > sale)
  21.            sale = li[i] * (n - i);
  22.     }
  23.    
  24.     cout << sale;
  25.    
  26.     return 0;
  27. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top