koishiQAQ @ 2023-11-29 22:20:37
#include<stdio.h>
#include<string.h>
#include<iostream>
using namespace std;
struct stu {
string name;
int score[3];
int sum;
};
struct stu mem[1000];
int main()
{
int n,j,i,f=0;
cin >> n;
for (i = 0; i < n; i++)
cin >> mem[i].name >> mem[i].score[0] >> mem[i].score[1] >> mem[i].score[2];
for(i = 0; i < n; i++)
mem[i].sum= mem[i].score[0]+ mem[i].score[1]+mem[i].score[2];
int maxIndex = 0;
for (i = 1; i < n; i++)
if (mem[i].sum > mem[maxIndex].sum)
maxIndex = i;
cout << mem[maxIndex].name << " " << mem[maxIndex].score[1] << " " << mem[maxIndex].score[2] << " " << mem[maxIndex].score[3] << endl;
return 0;
}