文章
35
粉丝
134
获赞
55
访问
24.7k
#include <bits/stdc++.h>
using namespace std;
struct node{
string num;
int s1,s2,s3;
int sum;
};
int cmp(node n1,node n2){
return n1.sum>n2.sum;
}
int main(){
int n;
cin>>n;
node arr[n];
for(int i=0;i<n;i++){
cin>>arr[i].num>>arr[i].s1>>arr[i].s2>>arr[i].s3;
arr[i].sum = arr[i].s1+arr[i].s2+arr[i].s3;
}
sort(arr,arr+n,cmp);
for(int i=0;i<n;i++){
cout<<arr[i].num<<" "<<arr[i].s1<<" "<<arr[i].s2<<" "<<arr[i].s3<<endl;
}
return 0;
}
登录后发布评论
暂无评论,来抢沙发