Pharaoh_ @ 2024-05-14 10:52:58
#include <bits/stdc++.h>
using namespace std;
struct a{
string a;
int b,c,d,e;
}student[1000];
int main(){
int n;
cin>>n;
for(int i=0;i<n;i++){
cin>>student[i].a>>student[i].b>>student[i].c>>student[i].d;
student[i].e=student[i].b+student[i].c+student[i].d;
}
int sum=student[0].e;
int m=0;
for(int i=i;i<n;i++){
if(student[i].e>sum){
m=i;
}
}
cout<<student[m].a<<" "<<student[m].b<<" "<<student[m].c<<" "<<student[m].d;
return 0;
}
by _th_tw_on_ @ 2024-05-14 12:59:29
第16行 i=i
是什么鬼
by _th_tw_on_ @ 2024-05-14 13:00:50
#include <bits/stdc++.h>
using namespace std;
struct a{
string a;
int b,c,d,e;
}student[1000];
int main(){
int n;
cin>>n;
for(int i=0;i<n;i++){
cin>>student[i].a>>student[i].b>>student[i].c>>student[i].d;
student[i].e=student[i].b+student[i].c+student[i].d;
}
int sum=student[0].e;
int m=0;
for(int i=0;i<n;i++){
if(student[i].e>sum){
m=i,sum=student[i].e;
}
}
cout<<student[m].a<<" "<<student[m].b<<" "<<student[m].c<<" "<<student[m].d;
return 0;
}
by Pharaoh_ @ 2024-05-14 23:34:13
@_th_twon 谢谢