Problem | Verdict | Lang | Time | Best | Rank | Submit Time |
---|---|---|---|---|---|---|
| discuss11900 - | Accepted | C++11 | 0.000 | 0.000 | 1953 | 4 mins ago |
#include<bits/stdc++.h>
using namespace std;
int main(){
ios::sync_with_stdio(false); cin.tie(nullptr);
int t, kase=0; cin >> t;
while(t--){
int n, p, q;
cin >> n >> p >> q;
multiset<int> a;
for(int i=1; i<=n; i++){
int x; cin >> x;
a.insert(x);
}
int s= 0, eggs= 0;
for(auto x:a)
if (s+x<=q){
s += x;
eggs++;
}
cout<<"Case "<<++kase<<": "<<min(eggs, p)<<"\n";
}
}
No comments:
Post a Comment