跳到正文

个人记录

1

Pizar约 1 分钟
原文
文章信息与版本

文章信息

发布
2026年10月1日
收录
2026年10月1日
更新
2026年11月10日
篇幅
约 1 分钟

版本

  1. v7当前
  2. v6
  3. v5
  4. v4
更早的 3 个版本
  1. v3
  2. v2
  3. v1
C++
#include<bits/stdc++.h>
using namespace std;
struct node{
	string s;
	int v1,v2,v3;
	int id;
}a[1005];
bool operator <(const node &u,const node &v){
	int s1=u.v1+u.v2+u.v3;
	int s2=v.v1+v.v2+v.v3;
	if(s1!=s2)return s1<s2;
	return u.id>v.id;
}
int main(){
	int n;cin>>n;
	for(int i=1;i<=n;++i){
		cin>>a[i].s>>a[i].v1>>a[i].v2>>a[i].v3;
		a[i].id=i;	
	}
	node mx=a[1];
	for(int i=2;i<=n;++i)
		mx=max(mx,a[i]);
	cout<<mx.s<<' '<<mx.v1<<' '<<mx.v2<<' '<<mx.v3;
}
原文