SHARE
TWEET

Untitled

a guest Nov 15th, 2019 90 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <fstream>
  2.  
  3. using namespace std;
  4.  
  5. ifstream f("arme.in");
  6. ofstream g("arme.out");
  7.  
  8. int main()
  9. {
  10.     int n,m,v[1001],x[1001],i,j,s=0;
  11.     f>>n>>m;
  12.     for(i=0;i<n;i++)
  13.         f>>v[i];
  14.     for(i=0;i<m;i++)
  15.         f>>x[i];
  16.     for(i=0;i<n-1;i++)
  17.         for(j=i+1;j<n;j++)
  18.             if(v[i]>v[j])
  19.                 swap(v[i],v[j]);
  20.     for(i=0;i<n;i++)
  21.         for(j=0;j<m;j++)
  22.             if(x[j]>v[i])
  23.                 swap(x[j],v[i]);
  24.     for(int i=0;i<n;i++)
  25.         s=s+v[i];
  26.     g<<s;
  27.  
  28.  
  29. }
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