cancan1030 @ 2023-06-11 14:35:23
#include<bits/stdc++.h>
using namespace std;
struct student
{
string name;
int chi;
int mat;
int eng;
int all;
};
int main()
{
int n;
cin>>n;
student a[n],max;
for(int i=0;i<n;i++)
{
cin>>a[i].name>>a[i].chi>>a[i].mat>>a[i].eng;
a[i].all=a[i].chi+a[i].mat+a[i].eng;
if(a[i].all>max.all) max=a[i];
}
cout<<max.name<<" "<<max.chi<<" "<<max.mat<<" "<<max.eng;
return 0;
}
by One_JuRuo @ 2023-06-23 20:19:08
@cancan1030 其实是第一个测试点的最高分是0...所以赋值-1也没问题
by cancan1030 @ 2023-06-24 11:42:17
@One_JuRuo 谢谢,已经解决了