Daniel_yao @ 2022-02-19 17:15:14
#include<bits/stdc++.h>
using namespace std;
struct node{
int x, y;
}a[5005];
int n, s, c, b, ans;
bool cmp(node x, node y){
if(x.y != y.y){
return x.y < y.y;
}
return x.x < y.x;
}
int main(){
cin >> n >> s >> c >> b;
for(int i = 1;i <= n;i++){
cin >> a[i].x >> a[i].y;
}
sort(a+1, a+n+1, cmp);
c += b;
for(int i = 1;i <= n;i++){
if(c >= a[i].x && s - a[i].y > 0){
s -= a[i].y;
ans++;
}
}
cout << ans;
return 0;
}
by Daniel_yao @ 2022-02-19 17:18:43
此题以切,本贴逝世。
by fake_ @ 2022-02-19 17:20:53
#include<bits/stdc++.h>
using namespace std;
int main(){
int a,b,c,d,e,f,g,h,i,j,k;
cin>>a>>b>>c>>d>>e>>f>>g>>h>>i>>j>>k;
int num=0;
if(a<=k+30) num++;
if(b<=k+30) num++;
if(c<=k+30) num++;
if(d<=k+30) num++;
if(e<=k+30) num++;
if(f<=k+30) num++;
if(g<=k+30) num++;
if(h<=k+30) num++;
if(i<=k+30) num++;
if(j<=k+30) num++;
cout<<num;
}
极水的答案