10分求调
查看原帖
10分求调
1769771
GEYIHAO楼主2025/6/18 19:29
#include <bits/stdc++.h>
using namespace std;
int n,e,m,c;
struct node{
	string name;
	int number,all,e,m,c;
}a[1005];
bool cmp(node x,node y){
	if(x.all!=y.all){
		return x.all>y.all;
	}else{
		return x.number>y.number;
	}
}
int main(){
	cin>>n;
	for(int i=1;i<=n;i++){
		cin>>a[i].name>>a[i].c>>a[i].m>>a[i].e;
		a[i].all=e+m+c;
	}
	sort(a+1,a+1+n,cmp);
	cout<<a[1].name<<" "<<a[1].c<<" "<<a[1].m<<" "<<a[1].e;
	return 0;
}

帮我必关注

2025/6/18 19:29
加载中...