Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- int main() {
- int n, x;
- cin >> n >> x;
- int tezina[n];
- for (int i = 0; i < n; ++i) {
- cin >> tezina[i];
- }
- sort(tezina, tezina + n);
- int i = 0;
- int j = n - 1;
- int gondoli = 0;
- while (i <= j) {
- if (tezina[i] + tezina[j] <= x) {
- ++i;
- }
- --j;
- ++gondoli;
- }
- cout << gondoli << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement