编译错???
查看原帖
编译错???
476081
Jeff_赵楼主2022/8/15 10:00

以下是错误代码??

#include<bits/stdc++.h>
using namespace std;
const int N=5e5+10;
struct T{ double x,y; }t[N];
bool cmp(int a, int b){ 
	return t[a].y<t[b].y; 
}
int main(){
    double n,s,a,b,ans=0; 
	cin>>n>>s>>a>>b;
    for(int i=1; i<=n; i++)
	{
		cin>>t[i].x>>t[i].y;
	} 
    sort(t+1, t+1+(int)n);//懒癌 
    for(int i=1; i<=n; i++){
        if(t[i].x <= a+b && t[i].y<=s){ 
			s-=t[i].y; ans++; 
		}
    }
    cout<<ans<<endl;  
    return 0;
}

                    
2022/8/15 10:00
加载中...