yuyuyuyu12345 @ 2022-08-25 17:24:06
#include <iostream>
using namespace std;
struct student{
char c[100];
int y,s,e;
};
int main()
{
struct student stu[100];
int n;
cin>>n;
int max=0,sum=0,flag=0;
for(int i=0;i<n;i++)
{
cin>>stu[i].c>>stu[i].y>>stu[i].s>>stu[i].e;
sum=stu[i].y+stu[i].s+stu[i].e;
if(max<sum) {
max=sum;
flag=i;
}
}
cout<<stu[flag].c<<" "<<stu[flag].y<<" "<<stu[flag].s<<" "<<stu[flag].e;
}
by Zhang_Yang @ 2022-08-25 17:31:07
数组开小了,主函数数组开成1000+
by tommyfj @ 2022-08-25 17:35:44
楼上正解