Leven123 @ 2023-07-12 14:37:03
#include<bits/stdc++.h>
using namespace std;
struct T{
string xm;
int yw,sx,yy,id;
int zf(){
return yw+sx+yy;
}
}a[150];
bool cmp(T a,T b){
if(a.zf()!=b.zf()) return a.zf()>b.zf();
else return a.id<b.id;
}
int main(){
int n;
cin>>n;
for(int i=0;i<n;i++){
cin>>a[i].xm>>a[i].yw>>a[i].sx>>a[i].yy;
a[i].id=i;
}
sort(a,a+n,cmp);
cout<<a[0].xm<<" "<<a[0].yw<<" "<<a[0].sx<<" "<<a[0].yy;
return 0;
}
by czh1017 @ 2023-07-12 14:50:57
有可能是a数组开小了,n<=1000 你只有105
by czh1017 @ 2023-07-12 14:51:10
@Leven123
by Leven123 @ 2023-07-12 20:16:10
@czh1017 过了,谢谢大佬!