0
1
mirror of https://git.sb/baoshuo/OI-codes.git synced 2024-11-27 22:36:28 +00:00
OI-codes/Codeforces/1614/A/A.cpp
2022-04-01 18:33:24 +08:00

29 lines
544 B
C++

#include <bits/stdc++.h>
using std::cin;
using std::cout;
using std::endl;
int t, n, l, r, k, a[105];
int main() {
cin >> t;
while (t--) {
int ans = 0;
cin >> n >> l >> r >> k;
for (int i = 0; i < n; i++) {
cin >> a[i];
}
std::sort(a, a + n);
for (int i = 0; i < n; i++) {
if (k < a[i]) break;
if (l <= a[i] && a[i] <= r) {
k -= a[i];
ans++;
}
}
cout << ans << endl;
}
return 0;
}