mirror of
https://git.sb/baoshuo/OI-codes.git
synced 2024-11-27 21:56:28 +00:00
A - Divan and a Store
https://codeforces.com/contest/1614/submission/136995472
This commit is contained in:
parent
dfe3d78e9b
commit
5889f1bb0f
28
CodeForces/1614/A/A.cpp
Normal file
28
CodeForces/1614/A/A.cpp
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
#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;
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user