SHARE
TWEET

Untitled

Farjana_akter May 25th, 2019 70 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3. long long int a[200000];
  4. int main()
  5. {
  6.     long long int n,i,j,k,ans1=0,ans2=0;
  7.     cin>>n;
  8.     for(i=0;i<n;i++)
  9.         cin>>a[i];
  10.     sort(a,a+n);
  11.     for(i=1;i<n;i++)
  12.         ans1+=a[i];
  13.     for(i=0;i<n-1;i++)
  14.         ans2+=a[i];
  15.     cout<<ans2<<" "<<ans1<<endl;
  16.     return 0;
  17. }
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