思路:
输入每辆公交车的到达时间和到达学校需要的时间,如果发现到达时间小于等于 ,那么取到达时间的最大值,输出即可。
#include<bits/stdc++.h>
using namespace std;
int n,x,maxx=-1,s,t;
int main(){
scanf("%d%d",&n,&x);
while(n--){
scanf("%d%d",&s,&t);
if(s+t<=x){
maxx=max(maxx,s);
}
}
cout<<maxx;
return 0;
}