zyc1219 @ 2023-01-10 11:06:24
#include<bits/stdc++.h>
using namespace std;
struct student{
string name;
double Languages,math,English,w;
}m[1005];
string maxn;
double n,maxx,a,b,c;
inline void ans(){
for(int i=1;i<=n;i++){
cin>>m[i].name>>m[i].Languages>>m[i].math>>m[i].English;
m[i].w+=m[i].Languages+m[i].math+m[i].English;
if(m[i].w>maxx){
maxx=max(m[i].w,maxx);
maxn=m[i].name;
a=m[i].Languages,b=m[i].math,c=m[i].English;
}
}
}
int main(){
ios::sync_with_stdio(false);
cin.tie(0);
cin>>n;
ans();
cout<<maxn<<' '<<a<<' '<<b<<' '<<c;
return 0;
}
by 编码落寞 @ 2023-01-10 11:26:12
@zyc1219
可能出现总分等于0的情况
by zyc1219 @ 2023-01-10 11:48:00
@编码落寞 谢谢。