SHARE
TWEET

Untitled

a guest Mar 26th, 2020 59 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // распродажа
  2. #include <iostream>
  3. #include <algorithm>
  4. #include <string>
  5. #include <vector>
  6. using namespace std;
  7. int main()
  8. {
  9.     vector <int> mv;
  10.     int n, m, sum = 0;
  11.     cin >> n;
  12.     cin >> m;
  13.     int a;
  14.     for (int i = 0; i < n; i++) {
  15.         cin >> a;
  16.         mv.push_back(a);
  17.     }
  18.     sort (mv.begin(), mv.end());
  19.     for (int i = 0; i < m; i++) {
  20.         sum = sum + mv[i];
  21.     }
  22.     cout << sum * -1;
  23.     return 0;
  24. }
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